Skip to content

Instantly share code, notes, and snippets.

View jontsai's full-sized avatar
😎
h4x0ring

Jonathan Tsai jontsai

😎
h4x0ring
View GitHub Profile
//
// ViewController.swift
// UIKitLab
//
// Created by Jonathan Tsai on 10/27/14.
// Copyright (c) 2014 Hacktoolkit. All rights reserved.
//
import UIKit
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@jontsai
jontsai / README.md
Created April 1, 2016 22:51 — forked from bluesmoon/README.md
Pseudo-Random number generator that follows a Normal or Log-Normal distribution.

Marsaglia-polar.js

This script generates random numbers along a Normal or Log-normal distribution using the Marsaglia polar method.

There are four functions you can use:

  • normalRandom: Generate random numbers that follow a Normal distribution.
  • normalRandomInRange: Generate random numbers that follow a Normal distribution but are clipped to fit within a range
  • normalRandomScaled: Generate random numbers that follow a Normal distribution with a given mean and standard deviation
  • lnRandomScaled: Generate random numbers that follow a Log-normal distribution with a given geometric mean and geometric standard deviation
@jontsai
jontsai / yahoo_groups_get_aliases.js
Created July 6, 2016 18:43
Print Yahoo Groups Yahoo aliases
// 1. Create a unique bucket at https://requestb.in, update the URL in the code below
// 2. Go to Yahoo Group's members page
// 3. Paste the following one-liner into the console
// 4. Profit
YUI().use('node', 'io', function(Y) { var url = 'https://requestb.in'; var aliases= []; x = Y.all('.yg-yalias-span'); x.each(function(i) { aliases.push(i.getContent()); }); var aliasesStr = aliases.join(','); var cfg = { method : 'POST', headers: { 'Content-Type' : 'application/json', 'Access-Control-Allow-Origin' : '*' }, data : {aliases: aliasesStr}}; Y.io(url, cfg); console.log(aliasesStr); });
@jontsai
jontsai / README.md
Created October 20, 2016 04:34 — forked from pathikrit/README.md
My highly opinionated list of things needed to build an app in Scala
@jontsai
jontsai / .gitconfig
Last active October 20, 2016 17:42
jontsai's .gitconfig
# This can be copied to ~/.gitconfig for some common git settings and aliases
[user]
email = hello@jontsai.com
name = Jonathan Tsai (jontsai)
[alias]
br = branch
ci = commit
co = checkout
@jontsai
jontsai / modconfig.py
Created October 26, 2016 02:40 — forked from esoupy/modconfig.py
Python script to Modify a setting in a config or properties file. It will overwrite the existing assigned value or append the new variable if it isn't found.
#!/usr/bin/env python
__author__ = 'Eric Sales'
INFO="""
modconfig
Modify a setting in a config or property file.
It will overwrite the existing assignment or make an
addition if the variable isn't found."""
USAGE="""
@jontsai
jontsai / crxmake.sh
Last active June 17, 2017 11:38
crxmake.sh - Pack a Chromium extension directory into crx format
#!/bin/bash -e
#
# Purpose: Pack a Chromium extension directory into crx format
# Source: https://developer.chrome.com/extensions/crx
if test $# -ne 2; then
echo "Usage: crxmake.sh <extension dir> <pem path>"
exit 1
fi
@jontsai
jontsai / ThreadPoolExample.scala
Created July 18, 2017 00:09
Scala thread pool example
import java.util.concurrent.Executors
val pool = java.util.concurrent.Executors.newFixedThreadPool(2)
1 to 10 foreach { x =>
pool.execute(
new Runnable {
def run {
Thread.sleep(2000)
println("n: %s, thread: %s".format(x, Thread.currentThread.getId))
@jontsai
jontsai / ThreadPoolExample.scala
Created July 18, 2017 00:09
Scala thread pool example
import java.util.concurrent.Executors
val pool = java.util.concurrent.Executors.newFixedThreadPool(2)
1 to 10 foreach { x =>
pool.execute(
new Runnable {
def run {
Thread.sleep(2000)
println("n: %s, thread: %s".format(x, Thread.currentThread.getId))