Skip to content

Instantly share code, notes, and snippets.

@chrisn
chrisn / Dockerfile
Last active Aug 18, 2020
Compile audiowaveform in Docker for amazonlinux:1
View Dockerfile
FROM amazonlinux:1
RUN yum -y update
RUN yum -y install make wget tar gcc gcc-c++ file diffutils
RUN wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz && \
tar -xzvf cmake-3.7.2.tar.gz && cd cmake-3.7.2 && \
./bootstrap && make && make install
RUN yum -y install cmake autogen automake libtool \
gzip zip libcurl-devel zlib-static libpng-static xz git \
boost-static boost-devel \
bzip2-devel which gd-devel
@chrisn
chrisn / Dockerfile
Last active Jun 2, 2020
Compile audiowaveform for AWS Lambda
View Dockerfile
FROM amazonlinux:latest
RUN yum -y install make cmake3 autogen automake libtool gcc gcc-c++ wget tar gzip zip gd-devel flac-devel libvorbis-devel boost-devel libcurl-devel
# libid3tag
WORKDIR /root
RUN wget https://netix.dl.sourceforge.net/project/mad/libid3tag/0.15.1b/libid3tag-0.15.1b.tar.gz
RUN tar xzf libid3tag-0.15.1b.tar.gz
WORKDIR /root/libid3tag-0.15.1b
RUN ./configure && make && make install
@chrisn
chrisn / sinon-chai-expect.md
Last active Aug 26, 2016 — forked from patocallaghan/sinon-chai-expect.md
Sinon Chai assertions in expect style. Examples from http://chaijs.com/plugins/sinon-chai
View sinon-chai-expect.md

Sinon JS

Spies

// Anonymous function
var spy = sinon.spy();

// Anonymous named function
var spy = sinon.spy().named('a callback');
@chrisn
chrisn / .eslintrc.js
Last active Jun 22, 2017
eslint config file
View .eslintrc.js
module.exports = {
"env": {
"browser": true,
"amd": true
},
"extends": "eslint:recommended",
"rules": {
"array-bracket-spacing": ["error", "never"],
"brace-style": ["error", "stroustrup"],
"block-scoped-var": "error",
@chrisn
chrisn / drop_shadow
Created Dec 28, 2013
Add a drop shadow to an image, using ImageMagick
View drop_shadow
convert <input-file> \( +clone -background black -shadow 30x8+0+0 \) +swap -background none -layers merge +repage <output-file>
@chrisn
chrisn / robocopy_backup
Created Dec 26, 2013
robocopy command to backup to a shared drive
View robocopy_backup
robocopy D:\ Z:\BackupDir /MIR /XD "$RECYCLE.BIN" "System Volume Information" /FFT
@chrisn
chrisn / .gitconfig
Last active Dec 29, 2015
Git configuration
View .gitconfig
[alias]
st = status
dif = diff
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
wd = diff --word-diff
[color]
ui = true
@chrisn
chrisn / Preferences.sublime-settings
Created Nov 15, 2013
My Sublime Text 2 user settings
View Preferences.sublime-settings
{
// Controls auto pairing of quotes, brackets etc
"auto_match_enabled": false,
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
// Set to true to ensure the last line of the file ends in a newline
// character when saving
"ensure_newline_at_eof_on_save": true,
@chrisn
chrisn / popen3_test
Last active Nov 6, 2018
Ruby example of using Open3.popen3 with a select loop to read a child process's standard output and standard error streams.
View popen3_test
#!/usr/bin/env ruby
require 'open3'
# Returns true if all files are EOF
#
def all_eof(files)
files.find { |f| !f.eof }.nil?
end
@chrisn
chrisn / connect_pop3
Created Nov 2, 2013
Connect to POP3 server over SSL using openssl
View connect_pop3
openssl s_client -crlf -ign_eof -connect <pop3-server-address>:995