Skip to content

Instantly share code, notes, and snippets.

@flbuddymooreiv
flbuddymooreiv / compareschema.md
Last active August 21, 2017 10:03
Testing PostgreSQL Schema compliance

Assuming a database mydb, and a canonical database file defined in a file tables.sql, here is a way to tell if an operational schema differs from the canonical one:

pg_dump -U postgres -a mydb > mydbdata.sql
psql -U postgres -c "drop database mydbcanonical"
psql -U postgres -c "create database mydbcanonical"
psql -U postgres -d mydbcanonical -f tables.sql
psql -U postgres -d mydbcanonical -f mydbdata.sql
@flbuddymooreiv
flbuddymooreiv / streaming.md
Last active August 29, 2015 14:18
VLC streaming

The following bits assume a server:

  • IP address 192.168.0.1
  • Broadcasting rtsp on port 8554

Server streaming a file

/usr/bin/cvlc /path/to/file/or/playlist \
    --sout '#rtp{host=192.168.0.1,port=8554,sdp=rtsp://192.168.0.1:8554/}'

Note: The trailing / on the sdp parameter of the sout cvlc parameter is important when connecting from the client.

@flbuddymooreiv
flbuddymooreiv / multideep.md
Last active August 29, 2015 14:20
Multi-deep Bootstrap modals

These modals are created and destroyed on the fly in the DOM. For a complex modal hierarchy, it would be cumbersome and inefficient to load all possible modals all at one to use the normal bootstrap modal methodology to accomplish complex structure editing, so with this method, we can be a bit cleaner and more selective!

http://jsfiddle.net/flbuddymooreiv/0uxf0f6u/

Keybase proof

I hereby claim:

  • I am flbuddymooreiv on github.
  • I am buddy (https://keybase.io/buddy) on keybase.
  • I have a public key whose fingerprint is C5D0 9B78 E697 9F56 E863 1F65 FB17 7F25 4C01 DAEA

To claim this, I am signing this object:

@flbuddymooreiv
flbuddymooreiv / postgresqlaudit.md
Last active August 29, 2015 14:22
Enable basic CUD Auditing for Postgresql on public tables

Assumptions: The tables you want audited will have an integer column called id. This will then be later accessible in the audit table by the column row_id.

A table to store audit actions in:

create table logged_action (
    id              serial,
    table_name      text not null,
    user_name       text not null,
    action_tstamp   timestamp with time zone
        not null default current_timestamp,
@flbuddymooreiv
flbuddymooreiv / One Line Hello World ELF.md
Last active August 29, 2015 14:23
Create a Hello World Binary in a single line in bash

Run this command in a shell (bash is what has been tested), and you will get a 64-bit ELF binary that prints Hello World.

printf '\x7F\x45\x4C\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00\x01\x00\x00\x00\x35\x40\xB3\x04\x2C\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x40\xB3\x04\xB2\x0C\xEB\x1C\x62\x00\x00\x00\x62\x00\x00\x00\x05\x00\x00\x00\x00\x10\x00\x00\x48\x65\x6C\x6C\x6F\x20\x77\x6F\x72\x6C\x64\x0A\xB9\x4C\x40\xB3\x04\x93\xCD\x80\xEB\xFB' > z && chmod +x z && ./z

Compare the size of this file to a simple hello world C program. This program only makes a system call and does not link against any libraries.

@flbuddymooreiv
flbuddymooreiv / HASTE.md
Created June 21, 2015 01:47
Headless Attachable Selenium Testing Environment (HASTE)

Motivation: Manually testing web applications stinks. Selenium offers a pretty impressive way of performing actions and waiting on reactions to occur. To watch it fly by is amazing. For a long-running test, this can be a bit bothersome, as the windows can be popping up and stealing mouse focus and such. The following document explains how to get an automated test environment running with standard tools to help improve the experience of running the tests.

This has been tested/set up on Debian 8.

Install the following items:

sudo apt-get install xvfb
sudo apt-get install x11vnc
sudo apt-get install vncviewer
@flbuddymooreiv
flbuddymooreiv / passgitgpg.md
Last active April 15, 2024 00:08
Setting up pass on git with a gpg key

The following shell transcript shows how to:

  • Create a GPG key
  • Create a pass database
  • Add git support to the pass database
  • Create a remote git repository
  • Push the pass database to the remote git repository
  • Fetch and display your passwords from another host

It is assumed that the pass package has been installed on both the first and second computers.

@flbuddymooreiv
flbuddymooreiv / sourcedestcompare.md
Last active August 29, 2015 14:23
Compare one directory tree's contents to another's (structure doesn't matter)
IFS=$'\n'; 
find /path/to/src -type f > sourcefiles
find /path/to/dest -type f > destfiles
for x in $(cat sourcefiles); do md5sum "$x" >> sourcechecksums; done;
for x in $(cat destfiles); do md5sum "$x" >> destfiles; done;

IFS=' '; 
hex="0 1 2 3 4 5 6 7 8 9 a b c d e f"; 
@flbuddymooreiv
flbuddymooreiv / cryptsetupluks.md
Last active March 25, 2023 19:19
CryptSetup / LUKS cheat sheet
# Install the tools
apt-get install cryptsetup

# -y for password confirmation prompt
cryptsetup -y -v luksFormat /dev/sdx # THIS DELETES ALL THE DATA

# Open it and look at status
cryptsetup luksOpen /dev/sdx cryptoblock
cryptsetup -v status cryptoblock