Skip to content

Instantly share code, notes, and snippets.

View geraint0923's full-sized avatar

Mark geraint0923

  • Hunger
  • Redwood
View GitHub Profile
163: 202.97
CN2: 59.43
@geraint0923
geraint0923 / Library_LaunchDaemons_com.noatime.root.plist
Created July 6, 2018 04:11 — forked from dmitryd/Library_LaunchDaemons_com.noatime.root.plist
"noatime" for OS X on SSD. Place this file to /Library/LaunchDaemons/com.noatime.root.plist and do `sudo launchctl load -w /Library/LaunchDaemons/com.noatime.root.plist`
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.noatime.root</string>
<key>ProgramArguments</key>
<array>
<string>/sbin/mount</string>
<string>-vuwo</string>
#!/usr/bin/env ruby
# This script is to add a release not on Github
#
# Requirement:
# Octokit.rb (gem install octokit)
# pandoc (for Mac: brew install pandoc)
#
# You must have $GITHUB_KEY exported in your .bashrc or .zshrc
# HELP: https://help.github.com/articles/creating-an-access-token-for-command-line-use/
# export GITHUB_KEY="replace with your Github access token"
set-window-option -g mode-keys vi
#setw -g mode-mouse on
#set-option -g mouse-select-pane on
bind-key | split-window -h
bind-key - split-window -v
# Automatically set window title
setw -g automatic-rename
# hSne traversal
bind-key -t vi-copy 'v' begin-selection
@geraint0923
geraint0923 / set-hostname.sh
Created October 1, 2015 07:22
Set Hostname on Mac OS X
sudo scutil --set HostName <putinyourhostname_or_fqdn_here>
@geraint0923
geraint0923 / ycm_extra_conf.py
Created September 18, 2015 07:10
Find include path for YCM in OS X
# echo | clang -std=c++11 -stdlib=libc++ -v -E -x c++ -
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set.
flags = [
'-Wall',
'-std=c++11',
@geraint0923
geraint0923 / JSON pretty printer
Created April 16, 2015 22:07
Pretty print the JSON format data
echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool
cat data.json | python -m json.tool
@geraint0923
geraint0923 / mpls_parser.c
Last active August 29, 2015 14:17
Parse the label from the packet
#include <pcap.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/if_ether.h>
#include <net/ethernet.h>
#include <netinet/ether.h>
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@geraint0923
geraint0923 / Spiral Matrix II
Created November 10, 2014 03:41
Spiral Matrix II
class Solution {
public:
void fill(vector<vector<int> > &vec, int dir, int idx, int start, int end, int &next) {
switch(dir) {
case 0: // left -> right
for(int i = start; i <= end; i++) {
vec[idx][i] = next;
next++;
}
break;