Skip to content

Instantly share code, notes, and snippets.

View artpi's full-sized avatar

Artur Piszek artpi

View GitHub Profile
@artpi
artpi / gist:a5f1d7c39bc0207e1163f3cb04ae6049
Created January 12, 2018 08:28
Download kindle my clippings file and parse them
class MyClippings extends Shortcode {
public $name = "my-clippings";
static $clippings;
static function load_clippings() {
if( ! self::$clippings ) {
self::$clippings = file_get_contents( "https://drive.google.com/uc?export=download&id=[SOME FILE ID FROM Gdrive]" );
}
}
function process( $filter ) {
self::load_clippings();
@artpi
artpi / btc-eth-dca-buy.php
Last active October 14, 2021 16:39 — forked from levelsio/btc-eth-dca-buy.php
This script runs daily and "Dollar Cost Average"-buys $40 BTC and $10 ETH per day
<?php
// Forked from @levelsio
function generateBitstampSignature( $nonce ) {
$message = $nonce . BITSTAMP_ID . BITSTAMP_KEY;
return strtoupper( hash_hmac( 'sha256', $message, BITSTAMP_SECRET ) );
}
@artpi
artpi / alfred evernote snippets
Last active February 10, 2018 17:39
Alfred Evernote Snippets
============================
Script filter:
var q = "{query}";
var values = Application('Evernote').findNotes("notebook:Snippets " + q);
var ret = '<?xml version="1.0"?><items>';
for (var i=0; i<values.length; i++ ) {
var title = values[i].title();
var val = values[i].htmlContent().replace(/<br\/>/g,'{enter}').replace(/<[^>]*?>/g,"");
var filendir = require('filendir');
function define(fileName, args, func) {
var content = '';
if (typeof func === 'function') {
content = "define('" + fileName + "', \n" + JSON.stringify(args).replace(/,/g, ",\n") + ", \n" + func.toString() + "\n);";
} else if (typeof args === 'function') {
content = "define('" + fileName + "',\n" + args.toString() + "\n);";
}
filendir.ws(fileName + ".js", content);
}
public function curl($Url,$args = array()) {
//Translate get params.
if(count($args)>0) {
$tab=array();
while (list($key, $value) = each($args)) {
$tab[]=$key."=".$value;
}
$get="?".implode("&",$tab);
} else {