Skip to content

Instantly share code, notes, and snippets.

@pedrovgp
pedrovgp / fetch_stock_prices_for_gnucash.py
Last active March 29, 2021 14:50
Python script to fetch stock prices for gnucash using http://alphavantage.co/ api. Since Quotes::Finance fetching from Yahoo finance no longer works, it is an alternative.
# INSTALL DEPENDENCIES BEFORE RUNNING: pandas, sqlite3, sqlalchemy, requests
# There is one thing you have to do though: gnucash needs to know the price's currency and it needs a guid (unique identifier)
# for this. This guid is unique for each installation, so you need to find yours and assign it to CURRENCY_GUID.
# OR: you can just leave it, and the script will fetch the currency from the last price added
import pandas as pd
import sqlite3
import sqlalchemy
from sqlalchemy import create_engine
import datetime

Guide to how fucked is SSL?

Thanks to Jacob Kaplan-Moss, Donald Stufft, David Reid, Allen Short, Zain Memon, and Chris Armstrong for review.

This is a guide for technical individuals to understand in what circumstances SSL communications are secure against an observer-in-the-middle (for all intents and purposes: the NSA).

@pcardune
pcardune / .gitignore
Created September 5, 2011 04:55
Facebook command-line client helper
.fb_access_token
.fbconsole.py
@bdarnell
bdarnell / fdserver.py
Created July 9, 2011 20:41
Demonstration of sharing file descriptors across processes
#!/usr/bin/env python
"""This is a demonstration of sharing file descriptors across processes.
It uses Tornado (need a recent post-2.0 version from github) and the
multiprocessing module (from python 2.6+). To run it, start one copy
of fdserver.py and one or more copies of testserver.py (in different
terminals, or backgrounded, etc). Fetch http://localhost:8000 and
you'll see the requests getting answered by different processes (it's
normal for several requests to go to the same process under light
load, but under heavier load it tends to even out).
@mimoo
mimoo / curve25519.sage
Created November 16, 2017 13:21
Curve25519 with sage
# create curve
ec = EllipticCurve(GF(2**255-19), [0,486662,0,1,0])
base_point = ec.lift_x(9)
point_at_infinity = ec(0)
# all elements of order 4
G4s = ec.lift_x(1, True)
G4 = ec.lift_x(1) # just the first element
# the element of order 2
@Drakulix
Drakulix / mingw-w64-3.10-osx10.9.sh
Last active January 9, 2020 11:49
Script to install a Mingw-w64 Cross-Compiler Suite on Mac OS X 10.9
#!/bin/sh
# dependencies
echo "Installing dependencies via Homebrew (http://brew.sh)"
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew update
brew install gcc48
@hdevalence
hdevalence / gist:aac098857248a1c3134eb8101b692547
Created October 30, 2016 17:13
convert sage integers to little endian byte strings
# v--- endianness issues here
bytestr_to_arr = lambda s:"[" + ", ".join(['0x'+b+a for a,b in zip(s[0::2], s[1::2])]) + "]"
ZZtobytestr = lambda x: "".join(ZZ(x).digits(16, '0123456789abcdef'))
@FiloSottile
FiloSottile / .ArmoryRPi.md
Created September 5, 2012 22:12
Building the Armory Bitcoin client for the Raspberry Pi

Armory on the RPi

Building the Armory Bitcoin client for the Raspberry Pi

This is how I got Armory (etotheipi/BitcoinArmory; http://bitcoinarmory.com/) cross-compiled for the Raspberry Pi.

This is a great way to keep an air-gapped offline wallet for only $30 dollars for the RPi (that you can also use for other things; experiment, it's awesome) and $7 for a Class 10 4GB SD card, really easy to keep in a safe and secret place.

Dependencies

@joyrexus
joyrexus / demo.txt
Last active October 19, 2018 22:25
Demonstrate how to extract and run code blocks from *.lang.md* files.
% marko.coffee -x try.python.md > try.py
% python try.py
hello world!
yes!
% marko.coffee -x try.python.md | python -s
hello world!
yes!
@FiloSottile
FiloSottile / rasterize.js
Created May 12, 2012 15:38
PhantomJS rasterize.js with "Retina" output
var page = require('webpage').create(),
address, output, size;
if (phantom.args.length < 2 || phantom.args.length > 3) {
console.log('Usage: rasterize.js URL filename');
phantom.exit();
} else {
address = phantom.args[0];
output = phantom.args[1];
page.viewportSize = { width: 1280, height: 1024 };