Skip to content

Instantly share code, notes, and snippets.

View ethnt's full-sized avatar
🐢

Ethan Turkeltaub ethnt

🐢
View GitHub Profile
@ethnt
ethnt / gist:901b110e83e259e9d64770b978239cba
Created July 19, 2016 18:51
llvm34 Homebrew install log
==> Installing llvm34 from homebrew/versions
==> Downloading http://llvm.org/releases/3.4.2/llvm-3.4.2.src.tar.gz
Already downloaded: /Users/ethan/Library/Caches/Homebrew/llvm34-3.4.2.tar.gz
==> Patching
patching file Makefile.rules
patching file tools/llvm-shlib/Makefile
patching file tools/lto/Makefile
==> Downloading http://llvm.org/releases/3.4.2/cfe-3.4.2.src.tar.gz
Already downloaded: /Users/ethan/Library/Caches/Homebrew/llvm34--clang-3.4.2.tar.gz
==> Downloading http://llvm.org/releases/3.4.2/libcxx-3.4.2.src.tar.gz
@ethnt
ethnt / chat-backup.rb
Created May 21, 2016 01:10
Ruby script to backup iMessage transcripts.
require 'pry'
require 'sqlite3'
require 'highline/import'
imessage_id = ask "iMessage ID (e.g., +8605555555): "
nickname = ask "Nickname (e.g., Bill): "
db = SQLite3::Database.new('/Users/ethan/Library/Messages/chat.db')
rows = db.execute "select * from message where handle_id=(
@ethnt
ethnt / citeproc
Last active January 1, 2016 15:59
http://rubydoc.info/gems/citeproc-ruby
[1] pry(main)> require 'unicode_utils'
=> true
[2] pry(main)> require 'citeproc'
=> true
[3] pry(main)> book = {
[3] pry(main)* 'author' => [{ 'given' => 'Edgar Allen', 'family' => 'Poe' }],
[3] pry(main)* 'title' => 'Poetry, Tales, and Selected Essays',
[3] pry(main)* 'type' => 'book',
function HelloWorld (name) {
this.name = name;
}
HelloWorld.prototype.sayHello = function() {
return "Hello there " + this.name;
}
var hi = new HelloWorld("Ethan");
hi.sayHello(); // => "Hello there Ethan"
@ethnt
ethnt / gist:7405897
Last active December 27, 2015 23:28 — forked from anonymous/gist:7405894

Randomness and Probability

  • Bernoulli trial: a random variable such that;
    1. Two possible outcomes, success and failure;
    2. Probability of success is always the same (P(success) = p);
    3. All trials are independent.

Examples:

  • fair coin (50% chance of heads and tails), heads = success, p = 1/2
function start(min_num, max_num) {
var min = min_num;
var max = max_num;
return result(min, max);
}
function guess(min_num, max_num) {
var guess = Math.floor((min + max) / 2);
@ethnt
ethnt / _rainbows.sass
Last active December 24, 2015 12:39
Make a rainbow border like on CreativeMornings.com.
@import compass/css3
// A lot of this is taken from Hugo Giraudel's post on CSS Tricks
// about this: http://css-tricks.com/striped-background-gradients/
// Create a rainbow-style border before or after an element.
//
// rainbows([$position, $size, $colors...])
@mixin rainbows($position, $size, $colors...)
$stripe-width: 100% / length($colors)
@ethnt
ethnt / gist:6575048
Created September 15, 2013 23:02
Cisco AnyConnect compaining.
Sep 15 00:30:14 tardis acwebsecagent[232]: OnConnectionFailure : Fail Open - Reason = Unable to verify the license key
Sep 15 00:30:14 tardis acwebsecagent[232]: Connection : Auth key is not provided or is invalid, applying connection failure policy. CMode : 2 TMode : 1
@ethnt
ethnt / gist:6059438
Created July 23, 2013 02:35
PostgreSQL
$ brew install postgresql

Do the launchctl stuff that Homebrew says to do.

$ initdb /usr/local/var/postgres
@ethnt
ethnt / gist:6040456
Created July 19, 2013 16:22
OS X bash profile. These are the very basics, without much configuration.
###
### .bash_profile
###
export PATH=/usr/local/bin:$PATH
# Get the aliases
source /Users/ethan/.bash_aliases
# Enable colors on the command line