Skip to content

Instantly share code, notes, and snippets.

@irisli
irisli / git-cheatshsheet.bash
Last active February 8, 2017 23:59
Git cheatsheet
# Do this thing in order
# First, you should set up your ssh keys for github. If not, then you'll have to type a usenrame and password every time
# https://help.github.com/articles/generating-ssh-keys
# CD into where you want to store this project
# Adding the repository for the first time
# With ssh keys
git clone git@github.com:irisli/61b-network.git
### Keybase proof
I hereby claim:
* I am irisli on github.
* I am irisli (https://keybase.io/irisli) on keybase.
* I have a public key whose fingerprint is 45DC 82FC 43C3 4C0B FAA4 940A B9CA 72E7 09C3 A153
To claim this, I am signing this object:
@irisli
irisli / stellarCurrencyDetector.js
Created September 4, 2014 00:00
Detects which characters are valid in Stellar.
// Ways to use this:
// node stellarCurrencyDetector.js | sh
// node stellarCurrencyDetector.js | sh > stellarCurrencyDetectorOutput.txt
// Test results can be seen here: https://www.stellar.org/viewer/#test/gHQbh2U1CzPo4kH93CCmL5oxK79SqcT7mm
var hexes = [];
for (var i = 0; i <= 255; i++) {
hexes.push(i.toString(16).toUpperCase());
}
@irisli
irisli / stellard-ws-timeout-test.js
Last active August 29, 2015 14:07
live.stellard.org timeout test
var WebSocket = require('ws')
, ws = new WebSocket('ws://live.stellar.org:9001');
var start = null;
var accounts = ['gDSSa75HPagWcvQmwH7D51dT5DPmvsKL4q'];
ws.on('open', function() {
console.log('WebSocket connection opened.');
start = new Date();
setInterval(function() {
#!/bin/bash
function flask-boilerplate-tmux
{
# https://github.com/swaroopch/flask-boilerplate
BASE="$HOME/code/flask-boilerplate"
cd $BASE
tmux start-server
tmux new-session -d -s flaskboilerplate -n model
@irisli
irisli / gist:87d3b964d51648ce0763
Created February 12, 2015 21:58
Bundlr link scraper
// I originally hacked together this script to scrape links from this bundlr page: http://bundlr.com/b/stellar-press
(function(){
result = "";
$("#bundle-clips-list > li").each(function(k,v) {
title = $(v).find(".clip-title").text().trim();
url = $(v).attr('data-clip-url');
result += '<p><a href="' + url + '">' + title + '</a></p>\n';
});
@irisli
irisli / twitterDateFormat.js
Created February 20, 2015 00:58
Twitter Date Format
// This formats dates like how Twitter does on their tweets I originally wrote
// this because I did not want to add an external dependency (such as moment) to
// my project for something so insignificant (date format). I couldn't have
// easily generated it on the server side since the dates are relative to the
// end user's browser's timezone (and I specifically wrote this to run on the
// client).
//
// Usage: twitterDateFormat(time)
// time can be anything JS' Date can understand
@irisli
irisli / callerName.js
Last active July 18, 2023 14:03
JavaScript get caller in strict mode
"use strict";
var stackTrace = (new Error()).stack; // Only tested in latest FF and Chrome
var callerName = stackTrace.replace(/^Error\s+/, ''); // Sanitize Chrome
callerName = callerName.split("\n")[1]; // 1st item is this, 2nd item is caller
callerName = callerName.replace(/^\s+at Object./, ''); // Sanitize Chrome
callerName = callerName.replace(/ \(.+\)$/, ''); // Sanitize Chrome
callerName = callerName.replace(/\@.+/, ''); // Sanitize Firefox
console.log(callerName)
@irisli
irisli / stellar-58-frequency.txt
Created June 12, 2015 22:29
first characters of Stellar address base58 by frequency. Sample size is 220768 (65 times the number of possibilities not taking into account illegal combinations (58^2))
2099 gsg
2074 gsp
2063 gsX
2058 gsZ
2055 gsB
2046 gsj
2038 gsD
2035 gst
2035 gsh
2033 gsE
@irisli
irisli / gist:6e95763e91ce5013c6c2
Created June 18, 2015 03:36
stellar-58-frequency-first-two
First two characters. Total in data set is 220768
108914 gs
2088 g3
2067 g6
2056 gG
2055 go
2052 gy
2050 gd
2050 gV