Skip to content

Instantly share code, notes, and snippets.

library(tidyverse)
library(gganimate)
NUMPLAYERS = 45
ROUNDS = 5000
INITWEALTH = 45
#initialize the bank
#columns wealths of the NUMPLAYERS players
#rows show wealths of each of the ROUNDS ticks of the clocks
@rainly
rainly / .profile
Created March 2, 2017 14:24 — forked from developer88/.profile
Some PostgreSQL snippets
alias 'pg_sql_restore'='PGPASSWORD=SOMEPASSWORD psql -cO -U username -d dbname -h localhost -f ' # + set path to backup file
alias 'pg_tar_restore'='PGPASSWORD=SOMEPASSWORD pg_restore -cO -U username -d dbname -h localhost ' # + set path to backup file
@rainly
rainly / deploy.rb
Created March 2, 2017 14:10 — forked from developer88/deploy.rb
Deploy phpBB with Mina
require 'mina/bundler'
require 'mina/git'
set :application, "forum"
set :domain, '%SERVERNAME%'
set :deploy_to, "%PATH-TO-APPLICATION%"
set :repository, '%REPOSITORY-URL%.git'
set :branch, 'master'
set :login, "%LOGIN%"
@rainly
rainly / deploy.rb
Created March 2, 2017 14:10 — forked from developer88/deploy.rb
Deploy phpBB with Mina
require 'mina/bundler'
require 'mina/git'
set :application, "forum"
set :domain, '%SERVERNAME%'
set :deploy_to, "%PATH-TO-APPLICATION%"
set :repository, '%REPOSITORY-URL%.git'
set :branch, 'master'
set :login, "%LOGIN%"
@rainly
rainly / README.md
Created March 2, 2017 13:57 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@rainly
rainly / gist:553f3c73141ee07179cc93f2342866f0
Created January 16, 2017 13:16 — forked from zhuowater/gist:1046096
python BP ANN 神经网络
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math,random
import numpy as np
def rand(a, b):
return (b-a)*random.random() + a
def dtanh(y):
return 1.0-y*y
def mat(x):
@rainly
rainly / linux-http-tcp.md
Created October 21, 2016 08:10 — forked from v5tech/linux-http-tcp.md
linux下查看http 并发和 tcp连接数

linux查看httpd进程数

ps -ef | grep httpd | wc -l

查看Apache的并发请求数及其TCP连接状态

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
@rainly
rainly / latency.markdown
Created October 14, 2016 07:30 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@rainly
rainly / dns2https.php
Created October 8, 2016 13:21 — forked from diyism/dns2https.php
dns2https.php
<?php
/*
tcp dns client for google dns over https (https://dns.google.com)
ubuntu上使用:
在/etc/rc.local里加/usr/bin/php /home/<your_name>/dns2https.php
执行:
sysv-rc-conf unbound off
sysv-rc-conf dnscrypt-proxy off
@rainly
rainly / git_action_set_tutor.md
Created May 8, 2016 07:39 — forked from pastleo/git_action_set_tutor.md
My Git Action Sets & Tutorials

My Git Action Sets & Tutorial

Init the git repo

  • git clone <url> [path]
  • git init

Trouble-Free Actions