Skip to content

Instantly share code, notes, and snippets.

@Averroes
Averroes / ohlc.py
Created June 16, 2018 10:56 — forked from lanfon72/ohlc.py
OHLC chart with XlsxWriter.
# extended from http://xlsxwriter.readthedocs.io/example_chart_stock.html
from datetime import datetime
import xlsxwriter
workbook = xlsxwriter.Workbook('chart_ohlc_stock.xlsx')
worksheet = workbook.add_worksheet()
bold = workbook.add_format({'bold': 1})
date_format = workbook.add_format({'num_format': 'dd/mm/yyyy'})
@Averroes
Averroes / crypto-wrong-answers.md
Created May 18, 2018 11:28 — forked from paragonie-scott/crypto-wrong-answers.md
An Open Letter to Developers Everywhere (About Cryptography)
@Averroes
Averroes / latency.txt
Created May 18, 2018 11:26 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@Averroes
Averroes / function.php
Last active April 24, 2018 17:10 — forked from mikejolley/gist:1622409
WooCommerce - Set a custom add to cart URL to redirect to
<?php
function custom_add_to_cart_redirect() {
/**
* Replace with the url of your choosing
* e.g. return 'http://www.yourshop.com/'
*/
return get_permalink( get_option('woocommerce_checkout_page_id') );
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );
@Averroes
Averroes / hodl20.py
Created April 19, 2018 18:47 — forked from anthonytxie/hodl20.py
Hodl 20 Rebalancing Algorithm
def calc_allocations(self, date, quantity, cap):
"""Figure out ideal allocations for a given date"""
# {
# coin_name: (percent_allocation, data)
# }
top_market = self.get_top_market(date, quantity)
total_cap = sum([coin.market_cap for coin in top_market])
allocations = [{
@Averroes
Averroes / woocommerce-demo-plugin.php
Created April 6, 2018 18:39 — forked from BFTrick/woocommerce-demo-plugin.php
A demo WooCommerce plugin
<?php
/**
* Plugin Name: WooCommerce Demo Plugin
* Plugin URI: https://gist.github.com/BFTrick/3ab411e7cec43eff9769
* Description: A WooCommerce demo plugin
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
iMac-de-Pablo:~ Jorge$ ethminer --help
Usage ethminer [OPTIONS]
Options:
Work farming mode:
-F,--farm <url> Put into mining farm mode with the work server at URL (default: http://127.0.0.1:8545)
--farm-recheck <n> Leave n ms between checks for changed work (default: 500).
--no-precompute Don't precompute the next epoch's DAG.
Ethash verify mode:
-w,--check-pow <headerHash> <seedHash> <difficulty> <nonce> Check PoW credentials for validity.
@Averroes
Averroes / pitcairn_linux_clock_fix.md
Created November 30, 2017 21:24 — forked from Francesco149/pitcairn_linux_clock_fix.md
Gain massive GPU performance for Southern Islands AMD GPUs on Linux by removing DPM quirks in the kernel

Gain massive GPU performance for Southern Islands AMD GPUs on Linux by removing DPM quirks in the kernel

I recently found out that my r9 270x GPU was not hitting full clock speeds because it was being throttled by the kernel based on old bug reports on DPM stability. This was an easy fix on gentoo where recompiling the kernel is trivial, but on ubuntu and similar, rebuilding the kernel is not so straightforward, so here's a guide based on ubuntu 16.04 LTS. If you run gentoo or know what you're doing you can just skip to the relevant code.

On my r9 270x, this resulted in an overall improvement in frame-rates of up to 50%: Unigine Valley went from something like 30-40 fps average to 55-60 and osu! (running in wine) went from 0.33 ms (~3000fps) to 0.25ms (~4000fps).

Note that I'm no linux god and all this info was pieced together by googling and asking on forums (credits to the guys at phoronix for pointing me to the quirks code).

If you're using the proprietary amdgpu-pro driver, read until the end of the

@Averroes
Averroes / wp-query-ref.php
Created September 27, 2017 10:03 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(