Skip to content

Instantly share code, notes, and snippets.

@pablotron
pablotron / osiekhan-pwgen.c
Created Jul 26, 2020
generate ambiguous passwords
View osiekhan-pwgen.c
// 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
View keybase.md

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 Apr 9, 2019
SDL Trackpad Click Test
View Makefile
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 Sep 15, 2016
ROTP and Google Authenticator Example
View example run
# 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 Dec 16, 2015
python splat example
View splat.py
def splat(*args, **kwargs):
return (kwargs['delim']).join(args)
def out(fn, *args, **kwargs):
print(fn(*args, **kwargs))
out(splat, 'foo', 'bar', delim=',');
View choose.php
<?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'];
View vertical.sql
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 Feb 20, 2015
sample passenger apache vhost configuration
View gist:a483814d0abfe992e5d1
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 Feb 19, 2015
example recall database parser
View output excerpt
[{"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 Feb 19, 2015
example recall database parse and search
View output
[{"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",