Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher cciollaro

View GitHub Profile
View macosx_remove_java9.sh
sudo rm -fr /Library/Java/JavaVirtualMachines/jdk-9.jdk/
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
@vgmoose
vgmoose / image_matrix.py
Last active May 20, 2018
Creates a C array from a bitmap file
View image_matrix.py
import json
import sys
import os
print ".--=============--------------=============--."
print "| Welcome to Image Matrix Maker! |"
print ".--=============--------------=============--."
yeswords = ["yes", "y", "ya", "ok", "okay"]
View gist:3f880418b1879dbcc447
import sys
a = open(sys.argv[1]).read()
for x in range(0, len(a), 16):
line = a[x:x+16]
hexl = ' '.join(y.encode('hex') for y in line)
hexl += ' '*(47-len(hexl))
hexl = hexl[:24] + " " + hexl[24:]
line = line.replace("\n", ".")
@runarorama
runarorama / gist:a8fab38e473fafa0921d
Last active Apr 13, 2021
Compositional application architecture with reasonably priced monads
View gist:a8fab38e473fafa0921d
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]
@Lax
Lax / ipaddr_demo.rb
Created Jan 13, 2014
Ruby IPAddr class, inet_aton and inet_ntoa equivalence.
View ipaddr_demo.rb
require 'ipaddr'
IPAddr.new("192.168.0.1").to_i
=> 3232235521
IPAddr.new(3232235521, Socket::AF_INET).to_s
=> "192.168.0.1"
@alexbevi
alexbevi / pre-commit.sh
Created Aug 23, 2012
Git pre-commit hook that checks ruby source files for Pry breakpoints
View pre-commit.sh
# Git pre-commit hook to check all staged Ruby (*.rb/haml/coffee) files
# for Pry binding references
#
# Installation
#
# ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit
#
# Based on
#
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/