Skip to content

Instantly share code, notes, and snippets.

View cciollaro's full-sized avatar

Christopher cciollaro

  • Tokyo, JP
  • 18:51 (UTC +09:00)
View GitHub Profile
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", ".")
@Lax
Lax / ipaddr_demo.rb
Created January 13, 2014 08:25
Ruby IPAddr class, inet_aton and inet_ntoa equivalence.
require 'ipaddr'
IPAddr.new("192.168.0.1").to_i
=> 3232235521
IPAddr.new(3232235521, Socket::AF_INET).to_s
=> "192.168.0.1"
@vgmoose
vgmoose / image_matrix.py
Last active May 20, 2018 14:54
Creates a C array from a bitmap file
import json
import sys
import os
print ".--=============--------------=============--."
print "| Welcome to Image Matrix Maker! |"
print ".--=============--------------=============--."
yeswords = ["yes", "y", "ya", "ok", "okay"]
@alexbevi
alexbevi / pre-commit.sh
Created August 23, 2012 12:05
Git pre-commit hook that checks ruby source files for Pry breakpoints
# 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/
@runarorama
runarorama / gist:a8fab38e473fafa0921d
Last active April 13, 2021 22:28
Compositional application architecture with reasonably priced monads
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]
@schnell18
schnell18 / macosx_remove_java9.sh
Created October 8, 2016 13:26
MacOS X remove Java 9
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