This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// this script looks through chase credit card transactions looking for repeat description/amount combinations | |
// login to Chase, click credit card, set a time range, click download account activity (down arrow), choose CSV | |
// usage: node ./chase-subscription-finder.js Chase*Activity*.CSV | |
const fs = require('fs'); | |
const BLACKLIST = [ | |
'PEETZ', // coffee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zx | |
/** | |
* `npm install -g zx` | |
* | |
* I take photos on a Sony camera in RAW+JPG mode. | |
* I then scroll through all the photos in Darktable usually at least once. | |
* When I really like a photo I export it as DSC001.export.jpg or DSC001.insta.jpg. | |
* Sometimes I rate photos in Darktable but not always. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getDistance(p1, p2) { | |
var radlat1 = Math.PI * p1.lat/180; | |
var radlat2 = Math.PI * p2.lat/180; | |
var theta = p1.lng - p2.lng; | |
var radtheta = Math.PI * theta/180; | |
var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta); | |
dist = Math.acos(dist); | |
dist = dist * 180 / Math.PI; | |
dist = dist * 60 * 1.1515 * 1.609344 * 1000; | |
return dist; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculate the center/average of multiple GeoLocation coordinates | |
* Expects an array of objects with .latitude and .longitude properties | |
* | |
* @url http://stackoverflow.com/a/14231286/538646 | |
*/ | |
function averageGeolocation(coords) { | |
if (coords.length === 1) { | |
return coords[0]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
?> | |
<html> | |
<head> | |
<title><?php echo $_SERVER['SERVER_NAME']; ?></title> | |
<style> | |
body { | |
background-color: #000; | |
margin: 10px; padding: 0px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var amqp = require('amqplib'); | |
var exchange_name = 'pubsub'; | |
amqp.connect('amqp://localhost').then(function(conn) { | |
process.once('SIGINT', function() { conn.close(); }); | |
return conn.createChannel().then(function(channel) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#EXTM3U | |
#EXTINF:-1,Groove Salad: a nicely chilled plate of ambient beats and grooves. [SomaFM] | |
http://uwstream1.somafm.com:80 | |
#EXTINF:-1,Dub Step Beyond: Dubstep, Dub and Deep Bass. May damage speakers at high volume. [SomaFM] | |
http://somafm.com/dubstep.pls | |
#EXTINF:-1,Def Con Radio: SomaFM's special mix for Def Con [SomaFM] | |
http://somafm.com/defcon.pls | |
#EXTINF:-1,The Trip: Progressive house / trance. Tip top tunes. (Formerly Tag's Trance Trip) [SomaFM] | |
http://somafm.com/thetrip.pls | |
#EXTINF:-1,Suburbs of Goa [SomaFM] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include("mysql.ssi.php"); | |
#Naming conventions: http://support.eve-online.com/Pages/KB/Article.aspx?id=37 | |
#Sample page format: http://www.example.com/?a=kill_detail&kll_id=1000000 | |
# This is a script I wrote a few years ago to scrape Eve Online kill mails. I ran it on a single | |
# core 2.4 Ghz with 2GB of RAM for a week and it scraped a couple million kills. It stores data | |
# in a relational format, but I've since lost the schema file. It can be easily reverse | |
# engineered from this file though. It would scrape sequentially, it should have run multiple | |
# requests in parallel for better efficiency. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set("error_reporting", E_ALL & ~E_NOTICE); | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Genetic Algorithm : TSP : PHP Implementation by Thomas Hunter</title> | |
<style> | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cluster = require('cluster'); | |
const http = require('http'); | |
const numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
console.log(`Master ${process.pid} is running`); | |
// Fork workers. | |
for (let i = 0; i < numCPUs; i++) { | |
cluster.fork(); |
NewerOlder