Skip to content

Instantly share code, notes, and snippets.

@aniline
aniline / tts.py
Last active July 19, 2020 08:23
WIP scriptlet to use using Google cloud TTS api. For voice over and stuff.
#!/usr/bin/env python3
#
# usage: tts.py [-h] [-f SPEC_FILE] [ssml [ssml ...]]
#
# positional arguments:
# ssml ssml message file
#
# optional arguments:
# -h, --help show this help message and exit
# -f SPEC_FILE, --spec-file SPEC_FILE
@aniline
aniline / plook.py
Created June 7, 2020 06:32
An old directory lookup thingy.
#!/usr/bin/python3
import ldap, subprocess, sys, re
import textwrap
CONFIG1 = { 'server' : 'ldap://ad1.office1.com:3268',
'base_dn' : 'DC=Office1,DC=com',
'bind_dn' : 'user@office1.com',
'pw_prog' : ["Passwordprogram", 'optionforpasswordforoption1'],
'pw_verify': 15 } # length of password for sanity check.
@aniline
aniline / bifurcation.m
Created February 21, 2020 14:39
Render bifurcation diagram (octave script)
## Period doubling bifurcation
## https://en.wikipedia.org/wiki/Logistic_map
1;
function ret = popfn(prev, r)
ret = r * (prev) * (1-prev);
endfunction
# Iterate till n-iterations
@aniline
aniline / twb64.py
Created July 6, 2019 16:36
Tripwire style base64 encoding.
#!/usr/bin/env python3
#
# Tripwire style base64 encoding.
# It makes sense only for 4 byte aligned sequences and is slow.
# See: https://github.com/Tripwire/tripwire-open-source/blob/master/src/fco/signature.cpp#L201
#
# Example usage for MD5 sum of files as appearing in tripwire reports:
#
# md5sum * | python twb64.py
#
@aniline
aniline / getserial.rs
Created February 17, 2019 15:25
Serial read
///
/// Trivial serial read for sensor-y thingies.
/// Sends a new-line to 'trigger' whatever the thingy has to do.
///
/// Needs extern(al) crate termios and getopts (in case it was not obvious).
///
extern crate termios;
extern crate getopts;
use std::env;
@aniline
aniline / nvidia-docker-notes.org
Last active December 19, 2018 14:49
Nvidia docker runtime setup for CUDA images

Manual setup of nvidia-docker

To not use the pre-bundled images or .deb-s.

Runtime

  • Checkout (opencontainers/runc) from hash id’d from nvidia-container-runtime/runtime/runc and the nvidia-container-runtime/runtime/Makefile.
  • Patch (runc) with patch from directory matching the commit hash.
  • Build runc, and cp/rename it to nvidia-container-runtime (needs BSD make: bmake).
  • cp (runc) nvidia-container-runtime /usr/local/bin
@aniline
aniline / timer.py
Created April 19, 2018 14:56
Notification pop-up timer.
#!/usr/bin/env python
import time
import getopt
import sys
import subprocess
from gi.repository import Notify
def do_notify(message, sleep_s):
@aniline
aniline / ffvers.py
Created January 12, 2018 14:37
List ESR or quantum
#!/usr/bin/env python
#
# List Quantum migrated and non-migrated (ESR) firefox profiles.
# Assumes the preference 'extensions.lastAppVersion' kinda tells firefox version last used with a profile.
# Use at your own risk.
#
import os, sys, re
ff_path=os.environ['HOME']+'/.mozilla/firefox/'
@aniline
aniline / mc_cat.rs
Last active December 7, 2017 10:30
Multicast 'cat'
//
// mc_cat <mc group> <port> [<from addr>] | consumer
//
use std::env;
use std::net::{UdpSocket, SocketAddrV4, IpAddr, Ipv4Addr};
use std::str::FromStr;
use std::error::Error;
use std::io::Write;
macro_rules! eprintln(($($arg:tt)*) => { writeln!(&mut std::io::stderr(), $($arg)*).expect("Fail at failing."); } );
@aniline
aniline / tmux.conf
Created September 25, 2017 11:33
My .tmux.conf
set-option -g status on
set -g terminal-overrides 'xterm*:smcup@:rmcup@,rxvt*:smcup@:rmcup@'
# Emacs add prefix as well, keep telnet escape as prefix.
unbind-key C-b
set-option -g prefix C-]
set-option -g prefix2 C-x
# Emacs window management keys
unbind-key -T prefix 1