Skip to content

Instantly share code, notes, and snippets.

@irisli
irisli / 1-setupRaid.sh
Last active June 28, 2016 18:48
RAID setup for EC2 instances with ephemeral instance storage
# 8 disk raid 0
# sudo mdadm --create --verbose /dev/md0 --level=0 --name=EPHEMERAL_RAID --raid-devices=8 /dev/xvdb /dev/xvdc /dev/xvdd /dev/xvde /dev/xvdf /dev/xvdg /dev/xvdh /dev/xvdi
@irisli
irisli / creating-a-stellar-transaction.js
Last active November 5, 2015 17:12
Creating a Stellar transaction using JS Stellar SDK
// I made this gist in hopes that it is a good tutorial on creating, signing,
// and submitting a transaction using JS Stellar SDK.
// This gist assumes that you have:
// 1. Secret key of a funded account to be the source account
// 2. Public key of a funded account as a recipient
// 3. Access to JS Stellar SDK (https://github.com/stellar/js-stellar-sdk)
// This code can be run in the browser at https://www.stellar.org/developers/
// That site exposes a global StellarSdk object you can use.
@irisli
irisli / configure-make.txt
Created July 20, 2015 23:45
./configure && make
ubuntu@ip-172-31-34-58:~/stellar-core (master)./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '1000' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
@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
@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 / 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 / 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 / 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';
});
#!/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 / 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() {