Skip to content

Instantly share code, notes, and snippets.

View chrismcv's full-sized avatar

Chris McVittie chrismcv

  • Blue Zinc IT
  • Belfast
View GitHub Profile
@unimonkiez
unimonkiez / fix-jsx-files
Created June 18, 2017 14:12
Replace all js files containing jsx code to jsx extension
find src -type f -name '*.js' | xargs grep -c '/>' $1 | awk '!/:0/' | sed -r 's/\.js.+//g' | xargs -I file echo file.js file.jsx
imgadm update
imgadm import fdea06b0-3f24-11e2-ac50-0b645575ce9d
imgadm list | grep fdea
vi setupfifo.json
vmadm create -f setupfifo.json
## In FiFo Zone ##
zlogin fifo
@lancejpollard
lancejpollard / less2stylus.coffee
Created February 9, 2012 19:33
Convert LESS to Stylus for Twitter Bootstrap
# Quick hack of regular expressions to convert twitter bootstrap from LESS to Stylus
less2stylus = (string) ->
string = string
.replace(/^(\ *)(.+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets
.replace(/^(\ *)([^\ \n]+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets
.replace(/\ *\{\ *\n*/g, "\n") # remove opening brackets again (some random cases I'm too lazy to think through)
.replace(/\ *\}\ *\n*/g, "\n") # remove closing brackets
.replace(/\;\ *?$/gm, "") # remove semicolons
.replace(/@(\w+):(\ *)\ /g, (_, $1, $2) -> # replace @variable: with $variable =
"$#{$1}#{$2} = "
static readonly string[] videoCardBlacklist = {"8086:0116"};
static void DisableHwRenderingForCrapVideoCards()
{
if (!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("MY_VIDEO_CARD_REALLY_WORKS")))
{
return;
}
int osVersion = Environment.OSVersion.Version.Major * 100 + Environment.OSVersion.Version.Minor;
if (osVersion < 601)
@nstielau
nstielau / send_metric_to_statsd.sh
Created May 11, 2011 16:41
Send a metric to StatsD from bash
# Send a metric to statsd from bash
#
# Useful for:
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/)
# init scripts
# sending metrics via crontab one-liners
# sprinkling in existing bash scripts.
#
# netcat options:
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed.