Skip to content

Instantly share code, notes, and snippets.

View chew-z's full-sized avatar

Robert J. chew-z

  • Warsaw, Poland
View GitHub Profile
@chew-z
chew-z / Trading Journal Metadata
Last active August 29, 2015 14:03
New Trading Journal
---
title: 16-07
tags: ["trading", "EURUSD"]
notebook: Trading Journal
---
**2014-07-16 20:37** \-
@chew-z
chew-z / Personal Journal Metadata
Last active August 29, 2015 14:03
New Personal Journal
---
title: 16-07
tags: ["podróż"]
notebook: Personal Journal
---
**2014-07-16 20:37** \-
@chew-z
chew-z / PinBar2()
Last active August 29, 2015 14:08
my version of PinBar function
double PinBar2(int minimumBar) {
double o=Open[1], c=Close[1];
double h=High[1], l=Low[1];
double b = MathAbs( o - c );
if ((h-l) < minimumBar*pips2dbl) //ignoruj śmieci
return(0.0);
double wup = h - MathMax(o, c), wdn = MathMin(o, c) - l;
if (wup >= 2.0*b && wdn <= b) //długi górny wąs - sygnał na krótką
return (-wup/b);
if (wdn >= 2.0*b && wup <= b) //długi dolny wąs - sygnał na długą
@chew-z
chew-z / Visa
Last active February 15, 2016 15:05
generates random Visa card number passing Luhn check (in Pythonista)
#coding: utf-8
# generates random Visa card number passing Luhn check
import clipboard
import numpy as np
from decimal import Decimal
def split_cc(ccnum):
cclist = list(str(ccnum))
cclist.insert(4, ' ')
cclist.insert(9, ' ')
from operator import mul
import itertools
import numpy as np
import datetime
GAMMA = 0.57721566490153286061
li2 = 1.045163780117492784844588889194 # Li(x) = li(x) - li(2)
def factors(n):
#with list
#coding: utf-8
from operator import mul
import console
console.clear()
print 'Generating plot... (this may take a little while)'
import numpy as np
import matplotlib.pyplot as plt
GAMMA = 0.57721566490153286061
@chew-z
chew-z / Problem?
Last active August 29, 2015 14:16
#http://stackoverflow.com/questions/28252442/speeding-up-this-python-code-for-large-input/28261161#28261161
from bitarray import BitArray
from random import randint
import numpy as np
def SplitArray(l, r):
while(l < r):
k = randint(l, r)
arr.set_bit(k)
return SplitArray(l, k-2) + [k] + SplitArray(k+2, r)
@chew-z
chew-z / Bitly
Last active February 15, 2016 15:06
Shorten links with Bitly API in Pythonista
#coding: utf-8
#shortens urls from clipboard using bitly
import sys
import requests
import re
import clipboard
import keychain
def shorten(long_url, token):
if re.match('\w{40,40}', token):
#coding: utf-8
#translates using Google Translate via web
import requests
import re
import clipboard
from bs4 import BeautifulSoup
def translate(phrase):
if phrase == '':
raise Exception('Nothing found in clipboard')
@chew-z
chew-z / bing-wallpaper.sh
Created July 9, 2015 19:10
script downloading Bing wallpapers
#!/usr/bin/env zsh
# The mkt parameter determines which Bing market you would like to
# obtain your images from.
# Valid values are: en-US, zh-CN, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA.
#
# The idx parameter determines where to start from. 0 is the current day,
# 1 the previous day, etc.
#IDX=1
for IDX in 0 1 2