Skip to content

Instantly share code, notes, and snippets.

View mcandre's full-sized avatar

Andrew mcandre

  • Milwaukee, WI
View GitHub Profile
@mzero
mzero / ghc-clang-wrapper
Created October 31, 2013 06:53
This wrapper script *should* enable GHC 7.* to work on systems with Xcode 5. To use it, drop this script somewhere, make it executable, and run.... Then follow the instructions it prints out. What it will do is, instruction you to put a copy in /usr/bin, then re-run it sudo. It will then find all your GHC 7 settings files, and patch them to make…
#!/bin/sh
inPreprocessorMode () {
hasE=0
hasU=0
hasT=0
for arg in "$@"
do
if [ 'x-E' = "x$arg" ]; then hasE=1; fi
if [ 'x-undef' = "x$arg" ]; then hasU=1; fi
@rvantonder
rvantonder / example.py
Created November 7, 2013 13:31
This sprung from wanting to know the difference between currying and partial function application in the functional programming paradigm. An example in Python.
# Consider the function f, with arity 3:
f = lambda x,y,z: x+y+z
# Let's curry f:
f_curried = lambda x: lambda y: lambda z: x+y+z
# f_curried has arity 1. When called with an argument, it will
# return another function (say, g) of arity 1 down the chain, e.g.:
g = f_curried(1)
Colour21\255,255,255\
Colour20\245,222,179\
Colour19\200,240,240\
Colour18\0,217,217\
Colour17\179,146,239\
Colour16\174,129,255\
Colour15\122,204,218\
Colour14\102,217,239\
Colour13\209,202,137\
Colour12\230,219,116\
xmllint --valid --noout *.xml **/*.xml 2>&1 | awk "/no DTD found/ {e=0} /xsd/ {e=0}"
@arunoda
arunoda / gist:7790979
Last active March 13, 2025 14:30
Installing SSHPass

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@lstoll
lstoll / gist:7975423
Last active April 14, 2022 18:52
vmx options for OS X under VMWare
# These fields need to be in the vmx for OS X to function. You will probably need to delete the
# existing guestOS and ethernet0.virtualdev entries. You will also need to make sure the disk
# has been added as SCSI, and set as boot drive.
# You might also want to set a cron task as root in the VM to run:
# @reboot /usr/sbin/networksetup -detectnewhardware
# to make sure the VM configures networking
virtualHW.version = "9"
firmware="efi"
@stuntgoat
stuntgoat / indent_sql.el
Created February 10, 2014 08:55
An indentation heuristic for Emacs' sql-mode
(defun get-previous-indentation ()
"Get the column of the previous indented line"
(interactive)
(save-excursion
(progn
(move-beginning-of-line nil)
(skip-chars-backward "\n \t")
(back-to-indentation))
(current-column)))
@tejainece
tejainece / StreamToString.go
Created April 2, 2014 18:29
Golang: io.Reader stream to string or byte slice
import "bytes"
func StreamToByte(stream io.Reader) []byte {
buf := new(bytes.Buffer)
buf.ReadFrom(stream)
return buf.Bytes()
}
func StreamToString(stream io.Reader) string {
buf := new(bytes.Buffer)
@Liryna
Liryna / ARMDebianUbuntu.md
Last active April 21, 2025 18:35
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@kyledrake
kyledrake / ferengi-plan.txt
Last active January 10, 2025 14:02
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {