Skip to content

Instantly share code, notes, and snippets.

View jazzqi's full-sized avatar
🏠
Working from home

Fei Qi jazzqi

🏠
Working from home
View GitHub Profile
git tag -am "annotation goes here" tagname_goes_here # cut a tag
git tag -d tagname_goes_here # burn it
git tag -am "annotation goes here" tagname_goes_here # cut another tag
git push --tags # push tags to remote
git push origin :refs/tags/tagname_goes_here # delete tag from remote
@sofish
sofish / first.js
Created August 31, 2012 05:47
面试的时候我会经常问,js 中如何获得 <ul> 下的第一个 <li>,你的答案是什么?
// 大家写在评论中吧,代码高亮可以这样写:
// ```js
// your code
// ```
// update: Fri Aug 31 08:39:21
// copyright: https://gist.github.com/3549352
// 加个性能测试:http://jsperf.com/get-dom-s-first-element
var util = {};
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@treycordova
treycordova / ArbitrageFinder.js
Created April 2, 2013 19:40
ArbitrageFinder produces potential arbitrage information from a 2-dimensional hash table. The algorithm employed is Bellman-Ford's Algorithm, which has an overall runtime of O(n^3).
(function() {
var currencies = {
// US Dollar
"USD": {"USD": 0, "GBP": 0.616056, "EUR": 0.733837, "CAD": 0.983195, "JPY": 83.3786, "CNY": 6.56997, "INR": 45.2, "BRL": 1.66691, "RUB": 29.1986},
// British Pound
"GBP": {"USD": 1.62323, "GBP": 0, "EUR": 1.19119, "CAD": 1.59595, "JPY": 135.343, "CNY": 10.6646, "INR": 73.73, "BRL": 2.70578, "RUB": 47.396},
// Euro
"EUR": {"USD": 1.3627, "GBP": 0.8395, "EUR": 0, "CAD": 1.3398, "JPY": 113.62, "CNY": 8.9529, "INR": 61.5941, "BRL": 2.2715, "RUB": 39.7889},
// Canadian Dollar
@ZJONSSON
ZJONSSON / arb.js
Last active May 2, 2024 08:49
Bitcoin Arbitrage (extension)
// Get all k-combinations from array
function combinations(arr, k){
if (k==1) return arr;
var ret = [];
arr.forEach(function(d,i) {
combinations(arr.slice(i+1, arr.length), k-1)
.forEach(function(sub) {
var next = [].concat(sub);
next.unshift(d);
ret.push( next );
@leommoore
leommoore / file_magic_numbers.md
Last active July 25, 2024 20:01
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

/**
* Check for arbitrage bet.
*
* @class Arbitrage
*/
var Arbitrage = Arbitrage || {};
var args = [];
@somebox
somebox / osx-setup.sh
Last active December 11, 2021 13:05 — forked from foz/osx-setup.sh.md
Set up an OSX machine from zero to awesome. Uses Homebrew (and cask, fonts, etc). Focused on Ruby/Rails development, includes rvm, xquartz, editor fonts, sublime text, and many tools.
#!/bin/bash
# A script to set up a new mac. Uses bash, homebrew, etc.
# Focused for ruby/rails development. Includes many utilities and apps:
# - homebrew, rvm, node
# - quicklook plugins, terminal fonts
# - browsers: chrome, firefox
# - dev: iterm2, sublime text, postgres, chrome devtools, etc.
# - team: slack, dropbox, google drive, skype, etc
@FinlayDaG33k
FinlayDaG33k / gist:23a6134b1ad3e5f867a64219a374406e
Last active February 12, 2024 19:30
Minergate-cli ubuntu installation
Run this command to install MG-CLI:
sudo apt-get update && wget https://minergate.com/download/deb-cli -O minergate-cli.deb && sudo dpkg -i minergate-cli.deb
to start miner (4 cores for BCN) use this command:
minergate-cli -user <YOUR@EMAIL.KAPPA> -bcn 4
Feel free to send some of your earnings to me:
BTC (Don't attempt to send other coins to this address!): 17f77AYHsQbdsB1Q6BbqPahJ8ZrjFLYH2j