Skip to content

Instantly share code, notes, and snippets.

View ctrlcctrlv's full-sized avatar
🛠️
happy hacking

Fredrick Brennan ctrlcctrlv

🛠️
happy hacking
View GitHub Profile
#!/bin/bash
# Save $1 because `set` will overwrite it
QUEUE_TO_DELETE=$1;
# $1 is our job ID, $7 is our queue name
ATQ=`atq|awk '{print $1, $7}'`;
while read line
do
@ctrlcctrlv
ctrlcctrlv / hardsub.sh
Created July 29, 2014 18:35
Convert softsubbed MKV files into hardsubbed MP4 files for playback via Roku, low powered devices etc, keep all fonts intact.
#!/bin/sh
# HARDSUB.SH
# (c) 2014 Fredrick Brennan
#
# Usage notes:
# This script requires that ~/.fonts is in your fontconfig path.
# This script also requires mkvmerge, realpath and ffmpeg to be installed. Only supports SSA subs and MKV files.
# Also note that this script can take a long time to run.
# Run as `hardsub.sh FILE_NAME`
# You should be able to delete the following created files after it is done: done_subtitles.ass and the entire contents of ~/.fonts/MKV
@ctrlcctrlv
ctrlcctrlv / board_create.sql
Created September 24, 2014 14:15
board_create CREATE TABLE
CREATE TABLE `board_create` (
`uri` varchar(58) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY `uri` (`uri`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
<?php
function less_ip($ip) {
$ipv6 = (strstr($ip, ':') !== false);
$in_addr = inet_pton($ip);
if ($ipv6) {
// Not sure how many to mask for IPv6, opinions?
$mask = inet_pton('ffff:ffff:ffff:ffff:ffff:0:0:0');
} else {
<?php
if (php_sapi_name() != 'cli')
die();
include 'inc/functions.php';
$boards = listBoards();
foreach ($boards as &$board) {
//query(sprintf("ALTER TABLE `posts_%s` ADD `edited_at` DATETIME NULL", $board['uri'])) or error(db_error());
$config['meta_noindex'] = false;

Keybase proof

I hereby claim:

  • I am ctrlcctrlv on github.
  • I am copypaste (https://keybase.io/copypaste) on keybase.
  • I have a public key whose fingerprint is 6F12 EC72 A82A BCA3 5235 063A 10DD C983 901A A183

To claim this, I am signing this object:

@ctrlcctrlv
ctrlcctrlv / Blog 20160807.md
Last active August 8, 2016 06:19
Watch as I descend into the madness that is source code parsing in Python

I have been up for 18+ hours and I am literally laughing my ass off at how terrible computers are. This is everything great Sundays are made of.

I am making a supposedly simple library, which will allow Python scripts to globally connect to keyboard shortcuts and do actions, such as grab the focus, take a screenshot, whatever the script author wants. For my purpose it will be activating my in development accessibility application, QMouseKeys.

There are two interfaces to do this.

In Windows, you can hook into the system's message queue with pyHook, hook your listen function, then call pumpMessages() and you're getting back every keypress the user is making as a VK_* key code.

On X11, you activate the XRECORD extension, set up a recording context, and just like with Win32 you make an endless while loop that listens for the messages and you get them back as XK_* key codes.

fredrick@q ~ % scanelf -nR /usr/local/bin/pavucontrol
TYPE NEEDED FILE
ET_DYN libgtkmm-3.0.so.1,libatkmm-1.6.so.1,libgdkmm-3.0.so.1,libglibmm-2.4.so.1,libsigc-2.0.so.0,libcanberra-gtk3.so.0,libcanberra.so.0,libgtk-3.so.0,libgobject-2.0.so.0,libglib-2.0.so.0,libintl.so.8,libpulse-mainloop-glib.so.0,libpulse.so.0,libstdc++.so.6,libgcc_s.so.1,libc.musl-x86_64.so.1 /usr/local/bin/pavucontrol
fredrick@q ~ % scanelf -nR /usr/local/bin/termite
TYPE NEEDED FILE
ET_DYN libvte-2.91.so.0,libgtk-3.so.0,libgdk-3.so.0,libpangocairo-1.0.so.0,libpango-1.0.so.0,libcairo.so.2,libgobject-2.0.so.0,libglib-2.0.so.0,libstdc++.so.6,libgcc_s.so.1,libc.musl-x86_64.so.1 /usr/local/bin/termite
@ctrlcctrlv
ctrlcctrlv / Cargo.toml
Last active December 20, 2017 05:41
StackOverflow Piston problem
[package]
name = "stackoverflow-piston-example"
version = "0.0.0"
authors = ["Fred"]
description = "Note: This program can be used for both of the programs below. Simply use `cargo new` and save either of the below files as `src/main.rs`"
keywords = []
[dependencies]
piston = "0.35.0"
piston2d-opengl_graphics = "0.50.0"
@ctrlcctrlv
ctrlcctrlv / StyleA.md
Last active May 28, 2019 04:42
Style A for TT2020 font.

Style A

For each character:

  1. Export as SVG.
  2. Open SVG in Inkscape.
  3. Export PNG image at 600 DPI.
  4. Add layer mask (white). (gimp-layer-add-mask)
  5. Select layer mask. (gimp-layer-set-edit-mask)
  6. Filters→Render→Noise→Plasma… Turbulence 4.5. (plug-in-plasma)†