Skip to content

Instantly share code, notes, and snippets.

View yanik-ai's full-sized avatar
🪐
df0

yanik yanik-ai

🪐
df0
View GitHub Profile
# allow compare datetime.datetime and datetime.date types
def by_date_and_datetime(x):
if isinstance(x.date, datetime.datetime):
return x.date.date()
else:
return x.date
return sorted(profit_transactions + done_transactions,
key=by_date_and_datetime, reverse=True)
8701.9208984375,
8001.811217727662,
7579.575804595947,
7852.544248886108,
7412.933835754395,
7619.973080825806,
7115.814327850341,
6290.871151046753,
6080.863765258789,
5832.461726150512,
[Wed Aug 19 10:44:15 2015] [error] 2015-08-19 10:44:15,444 INFO [ckan.lib.base] /pages render time 0.074 seconds
[Wed Aug 19 10:44:15 2015] [error] 2015-08-19 10:44:15,519 INFO [ckan.lib.base] /api/i18n/en render time 0.001 seconds
[Wed Aug 19 10:44:17 2015] [error] [client 127.0.0.1] Error - <type 'exceptions.UnboundLocalError'>: local variable 'lxml' referenced before assignment
[Wed Aug 19 10:44:17 2015] [error] [client 127.0.0.1] URL: http://localhost/pages/ololo
[Wed Aug 19 10:44:17 2015] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/weberror/errormiddleware.py', line 162 in __call__
[Wed Aug 19 10:44:17 2015] [error] [client 127.0.0.1] app_iter = self.application(environ, sr_checker)
[Wed Aug 19 10:44:17 2015] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 147 in __call__
[Wed Aug 19 10:44:17 2015] [error] [client 127.0.0.1] resp = self.call_func(req, *args, **self.kwargs)
[Wed Aug 19 10:44:17 2015] [err
@yanik-ai
yanik-ai / install_python3.sh
Last active September 11, 2015 12:38 — forked from chaosmail/install_python3.sh
Install Python 3.4.3 on Ubuntu
## Common Packages
# ---------------
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install software-properties-common libssl-dev openssl wget
## Install latest Python 3
# -----------------------
PY_VERSION=3.4.3
PY_URL="https://www.python.org/ftp/python/$PY_VERSION/Python-$PY_VERSION.tgz"
@yanik-ai
yanik-ai / fix os x
Created January 20, 2016 13:58
Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
eval $(docker-machine env default)
@yanik-ai
yanik-ai / Protocol.txt
Created February 17, 2016 13:52 — forked from ripper234/Protocol.txt
How to decode messages stored in the Bitcoin blockchain with btcmsg
BTCmsg Protocol v1 (2011-09-18)
===============================
Each message is represented by multiple payment which is calculated by
the following algorithm:
1. Two first chars for message type ('01' for md5, '02' for ascii).
2. Then the message in hex (python binascii.hexlify).
3. Split the long string to groups of 4 hex digits.
4. Each group of 4 hex (e.g. 2 ascii letters from the message) is
represented by a payment in satoshi (maximum 0xffff=65535).
@yanik-ai
yanik-ai / gist:11b471ae19f98a5abcd0
Created March 22, 2016 14:27
socket.error: [Errno 98] Address already in use: ('0.0.0.0', 30303)
// or any othe port
sudo netstat -ltnp | grep ':30303'
// will return
tcp6 0 0 :::30303 :::* LISTEN 844/S20geth
sudo kill -9 844
@yanik-ai
yanik-ai / nginx-custom-build.sh
Created March 25, 2016 16:42
Build Ubuntu or Debian packages for nginx with custom patches, configs, and name suffixes in one command
#!/bin/bash
# Author: Alexander Rodin <rodin.alexander@gmail.com>
# License: MIT
BUILD_DIR=build
while getopts "hp:s:r:b:o:c:n" opt; do
case $opt in
h)
echo "Usage: $0 [options]"
@yanik-ai
yanik-ai / Random generator
Created March 29, 2016 21:44 — forked from alexvandesande/Random generator
A very simple random generator. A miner can influence the number by not publishing a block with an unwanted outcome, and forfeiting the 5 block reward.
contract random {
/* Generates a random number from 0 to 100 based on the last block hash */
function randomGen(uint seed) constant returns (uint randomNumber) {
return(uint(sha3(block.blockhash(block.number-1), seed ))%100);
}
/* generates a number from 0 to 2^n based on the last n blocks */
function multiBlockRandomGen(uint seed, uint size) constant returns (uint randomNumber) {
uint n = 0;
for (uint i = 0; i < size; i++){
docker-machine rm default
docker-machine create --driver virtualbox default