Skip to content

Instantly share code, notes, and snippets.

@aniline
aniline / tts.py
Last active Jul 19, 2020
WIP scriptlet to use using Google cloud TTS api. For voice over and stuff.
View tts.py
#!/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 Jun 7, 2020
An old directory lookup thingy.
View plook.py
#!/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 Feb 21, 2020
Render bifurcation diagram (octave script)
View bifurcation.m
## 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 Jul 6, 2019
Tripwire style base64 encoding.
View twb64.py
#!/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
#
View getserial.rs
///
/// 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 Dec 19, 2018
Nvidia docker runtime setup for CUDA images
View nvidia-docker-notes.org

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 Apr 19, 2018
Notification pop-up timer.
View timer.py
#!/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 Jan 12, 2018
List ESR or quantum
View ffvers.py
#!/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 Dec 7, 2017
Multicast 'cat'
View mc_cat.rs
//
// 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 Sep 25, 2017
My .tmux.conf
View 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