Skip to content

Instantly share code, notes, and snippets.

@codeck
codeck / java_overgfw.bat
Created July 11, 2014 20:12
a batch to make android sdk manager over gfw
set _JAVA_OPTIONS=-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=8181
rem alternatively,
rem set JAVA_TOOL_OPTIONS=-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=8181
"SDK Manager"
@codeck
codeck / strbuild.sh
Last active August 29, 2015 14:05
stellard build script
wget https://download.libsodium.org/libsodium/releases/libsodium-0.6.0.tar.gz
tar zvfx libsodium-0.6.0.tar.gz
cd libsodium-0.6.0/
./configure --prefix=`realpath .`-bin
make && make install
cd ..
#diff --git a/SConstruct b/SConstruct
#index a4dca74..024e5e0 100644
#--- a/SConstruct
@codeck
codeck / randpw.sh
Created March 27, 2015 13:51
random password
openssl rand 256|tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB'|head -c12
@codeck
codeck / mailsrv
Last active February 16, 2023 19:05
poorman's enterprise mail server
(mainly quoted from http://n3mesisfixx.blogspot.com/2013/07/configuring-exim4-to-route-to-many.html)
0. manage domain "enterprisedomain.com" and mx record and PTR/ip reverse name
1. install debian
2. setup exim4 domains
run $dpkg-reconfigure exim4-config'
set "type" as internet
set "mail name" to *somelocalname* eg. debian or change /etc/mailname+/etc/hosts
set "other dest domain"/dc_other_hostnames as "*somelocalname*; enterprisedomain.com;", make sure *somelocalname* in the list.
3. enable virtual alias
@codeck
codeck / fetch.sh
Last active August 29, 2015 14:22
A simple poll-based REST API data fetcher script
#!/bin/bash
#
# edit fetsh.lst as a TSV file and press 'q' to stop polling
# poll period: 1 second
#
while [ 1 ]
do
read -t 1 -n 1 char
if [[ $char == 'q' ]]
then
@codeck
codeck / run_xdrgen.sh
Created August 25, 2015 03:15
how to run xdrgen(a ruby-based project)
#apt-get install bundler
git clone https://github.com/stellar/xdrgen.git
bundle install --path vendor/bundle
bundle exec bin/xdrgen
@codeck
codeck / run_es6.sh
Created August 25, 2015 03:35
how to run es6 javascript
#apt-get install npm
#ln -s /usr/bin/nodejs /usr/bin/node
echo 'prefix = ${HOME}/.npm-packages' >> ~/.npmrc
git clone https://github.com/stellar/js-stellar-base.git && cd js-stellar-base
npm install -g babel
npm install
babel-node examples/test.js
@codeck
codeck / tune_wal_sqlite.sql
Created September 30, 2015 13:23
if .wal of sqlite increase always
PRAGMA journal_size_limit=0;
@codeck
codeck / gist:05c7240f3eab48919aac
Created December 5, 2015 14:34
debug scala implicit
$sbt
> projects
> project <subproject>
> set scalacOptions += "-Xlog-implicits"
> session list-all
/*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list