Skip to content

Instantly share code, notes, and snippets.

View tonygaetani's full-sized avatar
🏠
Working from home

Tony Gaetani tonygaetani

🏠
Working from home
View GitHub Profile
@riobard
riobard / tcpdump.txt
Last active August 12, 2022 08:19
Poem lines broadcast by my ISP-provided fiber optical modem
# My ISP-provided fiber optical modem broadcasts a line of a poem every ten seconds. Here's the tcpdump of the complete poem.
# The optical modem is made by Shanghai Nokia-Bell Co.,Ltd and its model number is G-140W-UD. It's provided by my ISP, China Unicom in Shenzhen.
$ tcpdump -i vlan10 ether proto 0x8300
15:59:00.720301 00:00:00:00:00:12 (oui Ethernet) > Broadcast, ethertype Unknown (0x8300), length 72:
0x0000: 0000 0000 e4ea 8386 d93c 5468 6520 6461 .........<The.da
0x0010: 7920 4920 6c6f 7374 206d 7920 7665 7279 y.I.lost.my.very
0x0020: 2066 6972 7374 2074 6f6f 7468 2c00 0000 .first.tooth,...
0x0030: 0000 0000 0000 0000 0000 ..........
15:59:10.740778 00:00:00:00:00:12 (oui Ethernet) > Broadcast, ethertype Unknown (0x8300), length 72:
@boneskull
boneskull / readme.md
Last active June 13, 2017 02:25
HOWTO: Install logentries agent & logentries-daemon on armhf (Debian Jessie)

Why?

Because Logentries doesn't publish .debs for armhf.

  1. Install Python 2.7
  2. sudo apt-get install python-simplejson -y
  3. Grab latest release tarball from GitHub
  4. Extract & enter new dir; sudo python setup.py install
  5. Grab logentries daemon tarball, hack around logentries dep:
@vasanthk
vasanthk / System Design.md
Last active March 29, 2024 06:27
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@yvele
yvele / line-by-line-rxjs-node.js
Created October 22, 2015 09:52
Line by line file reading with RxJS on Node.js
var Rx = require('rx');
var readline = require('readline');
var fs = require('fs');
var rl = readline.createInterface({
input: fs.createReadStream('lines.txt')
});
var lines = Rx.Observable.fromEvent(rl, 'line')
.takeUntil(Rx.Observable.fromEvent(rl, 'close'))
@EntropyWorks
EntropyWorks / aptly-mirror.sh
Last active September 17, 2021 17:46
This is my script for mirroring a bunch of apt repos. This only touches the very basics of what (aptly)[http://www.aptly.info/] can do.
#!/bin/bash
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
# Authored by Yazz D. Atlas <yazz.atlas@hp.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
@octosteve
octosteve / ImperialMarch.ino
Created October 1, 2013 22:19
Imperial march played on an Arduino with a Piezo Element
int speakerPin = 9;
int length = 70;
String notes[] = {"G4","G4", "G4", "D#4/Eb4", "A#4/Bb4", "G4", "D#4/Eb4","A#4/Bb4", "G4", "D5", "D5", "D5", "D#5/Eb5", "A#4/Bb4", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4", "G5","G4","G4","G5","F#5/Gb5", "F5","E5","D#5/Eb5","E5", "rest", "G4", "rest","C#5/Db5","C5","B4","A#4/Bb4","A4","A#4/Bb4", "rest", "D#4/Eb4", "rest", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4" ,"D#4/Eb4","A#4/Bb4", "G4"};
int beats[] = { 8, 8, 8, 6, 2, 8, 6 , 2 ,16 , 8, 8, 8, 6, 2, 8, 6, 2, 16,8,6,2,8,6,2,2, 2, 2,6,2,2,8,6,2,2,2,2,6,2,2,9,6,2,8,6,2,16 };
int tempo = 50;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
@leifg
leifg / Vagrantfile
Last active November 12, 2023 08:31
Add a second disk to system using vagrant
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
@doapp-ryanp
doapp-ryanp / gist:4595068
Created January 22, 2013 14:34
configure spotify for linux shortcut keys
#@see rynop.com for details
sudo apt-get install xbindkeys
####now put the following in ~/.xbindkeysrc:
#KeyboardPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"
XF86AudioPlay
#KeyboardStop
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active March 27, 2024 19:48
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@ahpook
ahpook / memorysize_raw.rb
Created September 8, 2011 00:28
Custom facter fact for raw memorysize.
# for some reason facter takes the raw memorysize and reports it as
# a formatted string, which is useless for calculation
#
Facter.add("memorysize_raw") do
confine :kernel => :linux
setcode do
size = 0
File.readlines("/proc/meminfo").each do |l|
size = $1.to_f if l =~ /^MemTotal:\s+(\d+)/