Skip to content

Instantly share code, notes, and snippets.

@yousefamar
yousefamar / dbs.js
Last active August 31, 2019 13:55
Snippets for finding the cheapest DBS umbrella company bodies
let things = [];
UBDs.map(u => u.id).forEach(id => {
fetch('https://dbs-ub-directory.homeoffice.gov.uk/org-page.php?id='+id).then(res => res.text()).then(text => {
let el = document.createElement('html');
el.innerHTML = text;
el = el.getElementsByClassName('pricing')[0];
if (!el) {
console.log(id, 'has no price');
return;
}
@yousefamar
yousefamar / cat-watcher.js
Created August 28, 2019 18:25
A script to watch the cats at Battersea (https://www.battersea.org.uk/cats/cat-rehoming-gallery) and notify us by email when a new one shows up
const fs = require('fs');
const https = require('https')
const { execSync } = require('child_process');
const queryFrequencyMs = 5 * 60 * 1000;
let seenNids = {};
const generateEmail = (() => {
const footer = `<h1>New cat alert!</h1>`;
@yousefamar
yousefamar / main.js
Created August 14, 2019 18:11
Scripts for playing back mlrec files
const TracePlayback = require('./trace-playback.js')
const tp = new TracePlayback('2019811-msgs.mlrec', '2019811-stat.mlrec', {
playbackBufferSize: 1000,
tickTimeMs: 100
});
tp.on('packet', packet => {
console.log(packet);
});
@yousefamar
yousefamar / .block
Last active July 8, 2019 10:23 — forked from timelyportfolio/.block
d3.drag on touch devices
license: mit
@yousefamar
yousefamar / string-substituter.html
Last active May 17, 2019 01:43
A simple, configurable, persistent, reactive search-and-replace tool
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>String Substituter</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/vue"></script> -->
<link rel='stylesheet' href='https://cdn.jsdelivr.net/gh/kognise/water.css@latest/dist/light.min.css'>
<style>
@yousefamar
yousefamar / mac2hostname.py
Created October 19, 2017 10:38
Prints hostnames (found in dns.log) corresponding to MAC addresses (found in dhcp.log)
#!/usr/bin/python3
import subprocess
from collections import defaultdict
import sys
#IPsByMAC = defaultdict(list)
#proc = subprocess.Popen('cat dhcp.log | bro-cut ts mac assigned_ip', shell=True, stdout=subprocess.PIPE)
#while True:
@yousefamar
yousefamar / split-by-mac.sh
Created October 18, 2017 07:48
Splits PCAP files into several by MAC address
#!/bin/sh
#
# Splits up a PCAP file by MAC addresses
#
# Authors:
# Yousef Amar <yousef@amar.io>
#
if [ $# -lt 1 ]; then
@yousefamar
yousefamar / keybase.md
Last active June 26, 2017 19:18
Keybase Proof

Keybase proof

I hereby claim:

  • I am yousefamar on github.
  • I am drmr (https://keybase.io/drmr) on keybase.
  • I have a public key whose fingerprint is 1DBB 55D3 6533 1AD1 554E 875C B85C 26CC 81EF 6F49

To claim this, I am signing this object:

@yousefamar
yousefamar / myactivity.js
Created March 30, 2017 13:44
Google MyActivity Scraper
const username = '';
const password = '';
require('nightmare')()
.goto('https://accounts.google.com/Login?continue=https://myactivity.google.com/item')
.wait('#Email')
.insert('#Email', username)
.click('#next')
.wait('#Passwd')
.insert('#Passwd', password)
@yousefamar
yousefamar / PKGBUILD
Created December 3, 2016 15:56
st PKGBUILD
# Maintainer: mar77i <mar77i at mar77i dot ch>
# Past Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Scytrin dai Kinthra <scytrin@gmail.com>
pkgname=st-git
_pkgname=st
pkgver=0.7.2.gf92ca6e
pkgrel=1
pkgdesc='Simple virtual terminal emulator for X'
url='http://st.suckless.org/'