Skip to content

Instantly share code, notes, and snippets.

@pablotron
pablotron / osiekhan-pwgen.c
Created July 26, 2020 18:46
generate ambiguous passwords
// osiekhan-pwgen: generate password from the following set of
// characters: "S5Ii1l|!0O:;,.`'" (excluding double quotes).
//
// Pass positive integer as the first parameter to specify length
// (defaults to 64 characters if unspecified).
//
// Example:
// > cc -O3 -W -Wall -Wextra -pedantic -std=c11 -o osiekhan-pwgen{,.c}
// > ./osiekhan-pwgen
// l||!.O';:;;i,51'S!:S..l;1S'0O`,.I'5'S,!,;SI`!Oil'S:llO;i:5!5lS5l

Keybase proof

I hereby claim:

  • I am pablotron on github.
  • I am pablotron (https://keybase.io/pablotron) on keybase.
  • I have a public key ASAfnhE09opLvwMqSLH-4WNnD0N2qRge4B4NMJg4BHi54go

To claim this, I am signing this object:

@pablotron
pablotron / Makefile
Created April 9, 2019 09:52
SDL Trackpad Click Test
CFLAGS=-W -Wall -O2 -pedantic $(shell sdl2-config --cflags)
LIBS=-lm $(shell sdl2-config --libs)
OBJS=sdl-click.o
APP=sdl-click
.PHONY=all clean
all: $(APP)
$(APP): $(OBJS)
@pablotron
pablotron / example run
Created September 15, 2016 21:29
ROTP and Google Authenticator Example
# install dependency
pabs@meh:~/git/test/rotp> sudo gem install rotp
# generate new secret and QR code URL
pabs@meh:~/git/test/rotp> ruby ./rotp-example.rb new asdf@example.com
QR Code URL: https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth%3A%2F%2Ftotp%2FAlonzo%27s%2520Totally%2520Secure%2520App%3Aasdf%40example.com%3Fsecret%3Dr7eslax2okb2dkr4%26issuer%3DAlonzo%2527s%2BTotally%2BSecure%2BApp
Secret: r7eslax2okb2dkr4
Provisioning URL: otpauth://totp/Alonzo's%20Totally%20Secure%20App:asdf@example.com?secret=r7eslax2okb2dkr4&issuer=Alonzo%27s+Totally+Secure+App
# at this point i used the QR Code URL above to configure Google Authenticator on my phone
@pablotron
pablotron / splat.py
Created December 16, 2015 21:20
python splat example
def splat(*args, **kwargs):
return (kwargs['delim']).join(args)
def out(fn, *args, **kwargs):
print(fn(*args, **kwargs))
out(splat, 'foo', 'bar', delim=',');
@pablotron
pablotron / choose.php
Created November 9, 2015 23:26
kirth ajax example (test at http://pmdn.org/kirth/)
<?php
try {
# check for choice_id
if (!isset($_POST['choice_id']))
throw new Exception('missing choice_id');
# extract choice from request
$choice_id = $_POST['choice_id'];
@pablotron
pablotron / vertical.sql
Last active November 2, 2015 21:56
example query
SELECT a.month,
product_id,
COUNT(*) AS num_tickets
FROM (
SELECT to_char(create_date, 'Mon') AS month,
product_id
FROM tickets
) a
@pablotron
pablotron / gist:a483814d0abfe992e5d1
Created February 20, 2015 20:05
sample passenger apache vhost configuration
pabs@web:/data1/www> less /etc/apache2/sites-available/tinyapps.pablotron.org
<VirtualHost *>
ServerName tinyapps.pablotron.org
ServerAlias tinyapps-static.pablotron.org
ServerAdmin tinyapps-admin@pablotron.org
DocumentRoot /data1/www/tinyapps.pablotron.org/public
Use BASIC_LOGS tinyapps.pablotron.org
Use MOD_DEFLATE
</VirtualHost>
@pablotron
pablotron / output excerpt
Created February 19, 2015 21:54
example recall database parser
[{"RECORD_ID"=>"98200",
"CAMPNO"=>"13V454000",
"MAKETXT"=>"BMW",
"MODELTXT"=>"320I",
"YEARTXT"=>"2014",
"MFGCAMPNO"=>"",
"COMPNAME"=>"SERVICE BRAKES, HYDRAULIC:POWER ASSIST:VACUUM",
"MFGNAME"=>"BMW of North America, LLC",
"BGMAN"=>"20120501",
"ENDMAN"=>"20130831",
@pablotron
pablotron / output
Created February 19, 2015 21:51
example recall database parse and search
[{"RECORD_ID"=>"98200",
"CAMPNO"=>"13V454000",
"MAKETXT"=>"BMW",
"MODELTXT"=>"320I",
"YEARTXT"=>"2014",
"MFGCAMPNO"=>"",
"COMPNAME"=>"SERVICE BRAKES, HYDRAULIC:POWER ASSIST:VACUUM",
"MFGNAME"=>"BMW of North America, LLC",
"BGMAN"=>"20120501",
"ENDMAN"=>"20130831",