Skip to content

Instantly share code, notes, and snippets.

@yousefamar
yousefamar / dbs.js
Last active Aug 31, 2019
Snippets for finding the cheapest DBS umbrella company bodies
View dbs.js
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 Aug 28, 2019
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
View cat-watcher.js
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 Aug 14, 2019
Scripts for playing back mlrec files
View main.js
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 Jul 8, 2019 — forked from timelyportfolio/.block
d3.drag on touch devices
View .block
license: mit
@yousefamar
yousefamar / string-substituter.html
Last active May 17, 2019
A simple, configurable, persistent, reactive search-and-replace tool
View string-substituter.html
<!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 Oct 19, 2017
Prints hostnames (found in dns.log) corresponding to MAC addresses (found in dhcp.log)
View mac2hostname.py
#!/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 Oct 18, 2017
Splits PCAP files into several by MAC address
View split-by-mac.sh
#!/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 Jun 26, 2017
Keybase Proof
View keybase.md

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 Mar 30, 2017
Google MyActivity Scraper
View myactivity.js
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)
View 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/'