Skip to content

Instantly share code, notes, and snippets.

View tranvictor's full-sized avatar

Victor Tran tranvictor

View GitHub Profile
0x63825c174ab367968EC60f061753D3bbD36A0D8F - FPR
0x4Cb01bd05E4652CbB9F312aE604f4549D2bf2C99 - APR
0x2295fc6BC32cD12fdBb852cFf4014cEAc6d79C10 - Custom (PT)
0x742e8BB8e6bDE9CB2DF5449f8de7510798727fB1 - APR
0x57f8160e1c59D16C01BbE181fD94db4E56b60495 - Utility (WETH)
0x3e9FFBA3C3eB91f501817b031031a71de2d3163B - APR
0x0232Ba609782Cea145Ec3663F52CF7aEb4AC773C - APR
0xa33c7c22d0BB673c2aEa2C048BB883b679fa1BE9 - APR
0x1d57EF26709beB756e026308413f685339A73A9D - APR
0x751Eea622edd1E3D768C18afbCaeC7DcE7750C65 - APR
@gsalgado
gsalgado / go-ethereum-code-walkthrough.md
Last active June 20, 2022 11:42
Code Walkthrough for new block in go-ethereum

Following a block from the network socket to the hard drive

Note: All links to the code are based on a fixed revision, so we can link line numbers. Code might have changed by now, nonetheless use these revisions when doing updates to this document.

Preconditons

  • the app was configured and started
  • all services registered
  • the discovery protocol discovered some nodes
  • the peermanager successfully connected a node
  • established an encrypted multiplexed session
@tranvictor
tranvictor / setup_server.sh
Created November 2, 2015 10:00
Setup Ubuntu server, ready to deploy Rails application with Nginx, MongoDB, Redis
echo ">> Prepare"
ls /etc/apt/sources.list.d/ | grep mongodb
if [ $? -ne 0 ]; then
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
fi
echo ">> Updating System"
sudo apt-get update
# handle current bug in grub menu
@ryandotsmith
ryandotsmith / main.go
Created January 15, 2015 01:10
Sending an OP_RETURN Bitcoin Transaction with Go using Chain's Bitcoin API
package main
import (
"bytes"
"encoding/hex"
"encoding/json"
"io/ioutil"
"log"
"net/http"
@tranvictor
tranvictor / gist:51f9c329dd3530f901f5
Last active August 29, 2015 14:10
Example of tuning kernel variables for production linux server
Add all the following lines to the file: “/etc/sysctl.conf”
fs.file-max = 5000000
net.core.netdev_max_backlog = 400000
net.core.optmem_max = 10000000
net.core.rmem_default = 10000000
net.core.rmem_max = 10000000
net.core.somaxconn = 100000
net.core.wmem_default = 10000000
net.core.wmem_max = 10000000
@masatomo
masatomo / gist:983a84bad9671dc29213
Last active February 28, 2018 08:49
How to use MongoDB 2.6.x on CircleCI (circle.yml)
dependencies:
cache_directories:
- mongodb-linux-x86_64-2.6.4
pre:
- if [[ ! -d mongodb-linux-x86_64-2.6.4 ]]; then wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz && tar xvzf mongodb-linux-x86_64-2.6.4.tgz; fi
- sudo /etc/init.d/mongodb stop
- sudo cp mongodb-linux-x86_64-2.6.4/bin/* /usr/bin
- sudo /etc/init.d/mongodb start
@rtt
rtt / tinder-api-documentation.md
Last active May 6, 2025 12:58
Tinder API Documentation

Tinder API documentation

Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

@jboner
jboner / latency.txt
Last active May 12, 2025 05:04
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@ngauthier
ngauthier / application_controller.rb
Created February 10, 2012 17:17
Anonymous session id in rails
class ApplicationController < ActionController::Base
def anonymous_id
if !session.has_key? :session_id
# LAME we have to write to the session to get it to initialize itself
# the following line could be anything that writes to the session
# except don't write to session_id, because that's what we need
session[:id] = session[:id]
end
session[:session_id]
end
@nragaz
nragaz / unicorn.rb
Created July 12, 2010 03:34
unicorn.rb
# unicorn_rails -c /srv/myapp/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
working_directory (rails_env == 'production' ? "/srv/myapp/current" : `pwd`.gsub("\n", ""))
worker_processes (rails_env == 'production' ? 10 : 4)
preload_app true
timeout 30
if rails_env == 'production'