Skip to content

Instantly share code, notes, and snippets.

View oryband's full-sized avatar
:shipit:
Shipping

Ory Band oryband

:shipit:
Shipping
View GitHub Profile
@oryband
oryband / remove_duplicates_interfacelift.py
Last active October 12, 2015 17:38
Removes lower resolution duplicate wallpapers downloaded from InterfaceLift.
#!/usr/bin/env python
# encoding: utf8
"""Removes lower resolution duplicate wallpapers downloaded from
InterfaceLift.
"""
import os, re
@oryband
oryband / cherrypy_static_server.py
Last active January 4, 2021 09:00
CherryPy Static Server
#!/usr/bin/env python
"""Static file server, using Python's CherryPy. Should be used when Django's static development server just doesn't cut."""
import cherrypy
from cherrypy.lib.static import serve_file
import os.path
class Root:
@cherrypy.expose
def index(self, name):
@oryband
oryband / perceptron.py
Created May 29, 2014 18:28
Perceptron implementation in python, without dependencies or 3rd-party modules (numpy).
"""Simple Perceptron implementation.
No 3rd-party modules (numpy) used.
"""
from math import copysign
def sgn(x):
"""Mathemetical sign function implementation.
@oryband
oryband / replace.py
Created October 6, 2014 14:56
Copy & replace text from input file to output file.
#!/usr/bin/env python
"""Copy & replace text from INPUT_PATH to OUTPUT_PATH."""
# Consts
REPLACE = ('\n', ' ', '\t')
REPLACE_WITH = (',')
INPUT_PATH = 'path/to/input.txt'
OUTPUT_PATH = 'path/to/output.txt'
@oryband
oryband / steam_not_interested.py
Last active August 29, 2015 14:23
Steam Not Interested list
#!/usr/bin/env python
"""Prints all your "Not Interested" list on steam.
You need to first fetch the "Not Interested" game id numbers list
from this page: http://store.steampowered.com/dynamicstore/userdata
The ids you need are under the "rgIgnoredApps" field.
I've put an example of these ids down below, just replace them with yours.
This script requires the requests and beautifulsoup4 packages,
so execute "pip install requests beautifulsoup4" first.
@oryband
oryband / prepare-commit-msg
Last active October 20, 2017 13:46
Appends branch name to git commit message.
#!/bin/bash
# prepends branch name and description to commit message
# inspired by the following articles:
# http://stackoverflow.com/a/26796665/207894
# http://blog.bartoszmajsak.com/blog/2012/11/07/lazy-developers-toolbox-number-1-prepend-git-commit-messages/
#
# put this in repo/.git/hooks/ and chmod +x the file
# see the following stackoverflow question about how
# to do this for every new/cloned repo:
# http://stackoverflow.com/a/8842663/207894
@oryband
oryband / gist:41c4e54ff88d92e3366644dc4f9a3db4
Created September 29, 2016 13:17
google_compute_instance_group_manager only allows creating groups according to google provider region configuratino
2016/09/29 15:46:06 [INFO] Terraform version: 0.7.4 84592f5967490d118aae0b61a25d589d269fd0b6
2016/09/29 15:46:06 [INFO] CLI args: []string{"...", "apply", "...", "-state", ".../terraform.state", "..."}
2016/09/29 15:46:06 [DEBUG] Detected home directory from env var: /home/ory
2016/09/29 15:46:06 [DEBUG] Detected home directory from env var: /home/ory
2016/09/29 15:46:06 [DEBUG] Attempting to open CLI config file: /home/ory/.terraformrc
2016/09/29 15:46:06 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/09/29 15:46:06 [DEBUG] Detected home directory from env var: /home/ory
2016/09/29 15:46:06 [DEBUG] New state was assigned lineage "cfd21e3e-22b2-4170-9880-3cb39f5cedad"
2016/09/29 15:46:06 [TRACE] Graph after step *terraform.ConfigTransformer:
@oryband
oryband / KinMobileSDKonEthereum-DirectoryTree.txt
Last active December 31, 2017 12:06
Kin Mobile SDK on Ethereum - Directory Tree
MyEthereumDapp/
├── MobileCode # ios code, will be discussed later on
├── .travis.yml # CI service configuration
└── truffle/ # testing framework
├── contracts/ # Solidity .sol smart contracts. Includes ERC20 token contracts used for tests
├── migrations/ # Truffle contract initialization code onto testrpc Ethereum node
├── scripts/ # helper scripts, used with Makefile
│ ├── prepare-tests.sh # set variables required for tests e.g. account keys, contract address
│ ├── testrpc-accounts.sh # wallet account predefined private keys
│ ├── testrpc-kill.sh # kill testrpc when tests are done
@oryband
oryband / KinMobileSDKonEthereum-Migrations.js
Last active December 31, 2017 12:18
Kin Mobile SDK on Ethereum - Migrations
const assert = require('assert');
let Migrations = artifacts.require('../contracts/Migrations.sol');
let TestToken = artifacts.require('../contracts/BasicTokenMock.sol');
module.exports = (deployer, network, accounts) => {
deployer.deploy(Migrations);
deployer.deploy(TestToken).then(async() => {
contract = await TestToken.deployed()
console.log(`TestToken contract deployed at ${contract.address}`);
@oryband
oryband / KinMobileSDKonEthereum-truffle.js
Last active December 31, 2017 12:18
Kin Mobile SDK on Ethereum - truffle.js
// ES6 support on ES5
require('babel-register');
require('babel-polyfill');
module.exports = {
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*', // Match any network id