Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Marley nmarley

View GitHub Profile
@nmarley
nmarley / facebook-contact-info-summary.rb
Created Mar 23, 2018 — forked from dylanmckay/facebook-contact-info-summary.rb
A Ruby script for collecting phone record statistics from a Facebook user data dump
View facebook-contact-info-summary.rb
#! /usr/bin/env ruby
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It dumps all cell phone call + SMS message + MMS records, plus a summary of each.
#
# Place this script inside the extracted Facebook data download folder
# alongside the 'html' folder.
#
@nmarley
nmarley / Effective_Engineer.md
Last active Feb 8, 2018 — forked from rondy/Effective_Engineer.md
Effective_Engineer.md
View Effective_Engineer.md

FWIW: I didn't produce the content present here. I've just copy-pasted it from somewhere over the Internet, but I cannot remember exactly the original source. I was also not able to find the author's name, so I cannot give him/her the proper credit.


Effective Engineer - Notes

What's an Effective Engineer?

@nmarley
nmarley / ipfs-peer-id.js
Created Nov 24, 2017
JavaScript Example: Get IPFS PeerID via API using js-ipfs-api
View ipfs-peer-id.js
const ipfsAPI = require('ipfs-api')
let ipfs = ipfsAPI('localhost', '5001')
ipfs.config.get('Identity.PeerID', (err, peerid) => {
if (err) { throw err }
console.log("PeerID = [" + peerid + "]")
})
@nmarley
nmarley / static-gen.sh
Last active Sep 28, 2017
Generate a static site from a WordPress site using wget
View static-gen.sh
#! /bin/bash
wget -mk http://kotblog.dash.org/
@nmarley
nmarley / x.sh
Created Sep 28, 2017
Generate a static site from a WordPress site using wget
@nmarley
nmarley / curl-websocket.sh
Created Sep 8, 2017 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
View curl-websocket.sh
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@nmarley
nmarley / Dockerfile
Last active Oct 11, 2017
DigitalOcean API Query Script
View Dockerfile
FROM alpine:3.5
RUN /bin/echo 'set -o vi' >> /etc/profile
RUN /bin/echo 'gem: --no-document' > /etc/gemrc
RUN apk update && apk upgrade && apk add --no-cache ruby ruby-dev ruby-io-console ruby-bigdecimal ruby-json ca-certificates && rm -fr /var/cache/apk/*
WORKDIR /app
COPY Gemfile Gemfile.lock query-resources.rb /app/
RUN gem install bundler
@nmarley
nmarley / do-tagsplit.sh
Created Aug 7, 2017
DigitalOcean tag splitter
View do-tagsplit.sh
#! /bin/bash
# TAGLIST=$(curl -s 169.254.169.254/metadata/v1/tags/)
TAGLIST="ansible-role:02-openvpn ansible-role:01-common app:OpenVPN name:testtagger01"
ROLE_TAGS=()
for T in $TAGLIST; do
IFS=:
read -r Key Value <<< "$T"
if [ "ansible-role" = "${Key}" ]; then
ROLE_TAGS+=($Value)
@nmarley
nmarley / do-network.sh
Created Jul 27, 2017
DigitalOcean cloud-init metadata IP address helper script
View do-network.sh
#! /bin/bash
# DigitalOcean cloud-init metadata IP address helper script
METADATA_URL="http://169.254.169.254/metadata"
PUBLIC_IPV4="$(curl -fs -m 2 $METADATA_URL/v1/interfaces/public/0/ipv4/address)"
ANCHOR_IPV4="$(curl -fs -m 2 $METADATA_URL/v1/interfaces/public/0/anchor_ipv4/address)"
FLOATING_ACTIVE="$(curl -fs -m 2 $METADATA_URL/v1/floating_ip/ipv4/active)"
FLOATING_IPV4="$(curl -fs -m 2 $METADATA_URL/v1/floating_ip/ipv4/ip_address)"
@nmarley
nmarley / pstat.pl
Created Jul 10, 2017
"Perl stat" -- really old, saving here, but removing from hard drive
View pstat.pl
#! /usr/bin/perl
use strict;
use warnings;
use feature qw(say);
use Data::Dumper;
use File::Slurp;
use Carp;
use Fcntl ':mode';
use DateTime;