Skip to content

Instantly share code, notes, and snippets.

View KolevDarko's full-sized avatar
🏠
Working from home

Darko Kolev KolevDarko

🏠
Working from home
View GitHub Profile

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@KolevDarko
KolevDarko / Angular mistakes
Last active August 29, 2015 14:22
List of common AngularJS mistakes
1. Always use objects when using binding in angular directives.
2. Everything is camel case, dashes don't exist in link function.
3. Add headers: headers: {'Content-Type': 'application/x-www-form-urlencoded'} when trying to submit form data with $http
4. $scope is not a model!!!
@KolevDarko
KolevDarko / cache.py
Created September 12, 2016 08:41 — forked from cloverstd/cache.py
tornado cache
# coding: utf-8
try:
import cPickle as pickle
except ImportError:
import pickle
try:
import hashlib
sha1 = hashlib.sha1
# Full code
import hmac
import time
from hashlib import sha256
import subprocess
import requests
secret_key = '' or input('Enter your secret key: ')
public_key = '' or input('Enter your public key: ')
@KolevDarko
KolevDarko / ba-profits-guide-1.py
Last active June 16, 2017 07:59
Snippet 1 from BitcoinAverage Bitcoin profits article
import hmac
import time
from hashlib import sha256
import subprocess
import requests
secret_key = '<your secret key here>' or input('Enter your secret key: ')
public_key = '<your public key here>' or input('Enter your public key: ')
def create_signature():
ts = str(int(time.time()))
sig = str(ts + "." + public_key).encode()
sign = hmac.new(secret_key.encode(), sig, digestmod=sha256).hexdigest()
signature = "{0}.{1}.{2}".format(ts, public_key, sign)
return signature
def main(exchange, starting_price, amount, currency, limit_type, limit):
"""
:param exchange: The exchange where bitcoin was bought
:param starting_price: The price at which bitcoin was bought
:param amount: The amount of bitcoin
:param currency: The currency bitcoin was bought in
:param limit_type: The type of threshold, percent or amount
:param limit: The value of the threshold
:return: Current profit made
"""
{
"name": "bitstamp",
"display_name": "Bitstamp",
"url": "https://bitstamp.net/",
"timestamp": 1493816831,
"data_source": "api",
"symbols": {
"XRPEUR": {
"last": 0.0513,
"volume": 5706005.4795,
def calc_percent_diff(now, base):
difference = now - base
return difference * 100 / base
def calculate_profits(cc, latest_bid, starting_price, amount, limit_type, limit):
difference = abs((latest_bid - starting_price) * amount)
single_diff = latest_bid - starting_price
if limit_type == 'percent':
percent_difference = calc_percent_diff(latest_bid, starting_price)
if percent_difference >= limit: