Skip to content

Instantly share code, notes, and snippets.

View SerpentChris's full-sized avatar

Chris Calderon SerpentChris

  • Sunnyvale
View GitHub Profile
@SerpentChris
SerpentChris / stringify.js
Last active May 13, 2017 02:44
A simple, recursive stringify implementation
function escape(string){
var chars = []
for(var i = 0 ; i < string.length; i++){
var c = string.charAt(i)
switch(c){
case '\n':
chars.push('\\n')
break
case '\t':
chars.push('\\t')
# Copyright (c) 2017 Christian Calderon
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
@SerpentChris
SerpentChris / randomColor.js
Last active September 15, 2017 19:35
Makes a random 8bit RGB color code.
function randomColor(){
var color = ''
for(var i=0; i<3; i++)
color += Math.floor(Math.random()*255).toString(16).padStart(2, '0')
return color
}
@SerpentChris
SerpentChris / primes.cpp
Last active January 19, 2017 23:02
Prime sieve in C++ and Python
/*
Copyright (c) 2017 Chris Calderon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@SerpentChris
SerpentChris / pyethereum-install-macos-sierra.txt
Created December 30, 2016 22:30
Installing pyethereum on macOS Sierra
Installing pyethereum on macOS Sierra took a few steps, which were not obvious.
First, you need to install the Xcode command line tools. To do this, open a terminal and type:
xcode-select --install
Next, you need to install Homebrew. You can find out how to do that by going to the website http://brew.sh .
Once you have Homebrew, you need to install python. I prefer python 3:
brew install python3
@SerpentChris
SerpentChris / .bashrc
Last active January 1, 2017 02:31
My .bashrc: complete with colored prompt, virtualenv support, and github support.
set_prompt () {
if venv_file=$(find-venv); then
source $venv_file
elif [ "$(type -t deactivate)" == "function" ]; then
deactivate
fi
PS1=$(append-git-branch)
}
GREY="\[\e[1;30m\]"