Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am elijahc on github.
  • I am elijahc (https://keybase.io/elijahc) on keybase.
  • I have a public key ASDDqd-L1akkOUjZ3DOpJyeZ25SHlZRnhytTalZrdiTQRgo

To claim this, I am signing this object:

@elijahc
elijahc / update-dns.py
Last active January 12, 2020 00:43
Python script for updating google domains dyndns entries
import requests
import psutil
import socket
import click
import pprint
import numpy as np
INTERFACES = psutil.net_if_addrs()
{
"embeddings": [
{
"tensorName": "Objective (xent+recon)",
"tensorShape": [
2500,
3136
],
"tensorPath": "https://gist.githubusercontent.com/elijahc/76c686a8a6d33a0808df871b03813ce7/raw/1272dd1bd3817c5b24f64ff45365130c0d672867/l1_rfs.tsv",
"metadataPath": "https://gist.githubusercontent.com/elijahc/76c686a8a6d33a0808df871b03813ce7/raw/36075d4702e9ccbb08236db524ec161d55f73ff1/l1_rfs_meta.tsv",
@elijahc
elijahc / _osx_vpn_split_tunneling.md
Last active May 8, 2025 22:01
Split tunneling my vpn connection

Install Openconnect for more flexible Cisco vpn client

Overview

I have a workstation behind a VPN at work that I like to remotely access for queuing jobs or data analysis over hosted jupyter notebooks.

Usually I just connect to using the Cisco Anyconnect client but it's caused some headaches.

I want to be able to route to these workstations using the VPN but since they throttle bandwidth use my local gateway for everything else (i.e. looking up docs, streaming spotify etc)

@elijahc
elijahc / bash_func.sh
Last active July 29, 2022 03:23
Setting up Cisco vpn using openconnect with secure stdin password loading
# Configure so you don't need enter passwd for openconnect and kill
function vpnsetup() {
sudo sh -c 'echo "%admin ALL=(ALL) NOPASSWD: /usr/local/bin/openconnect, /bin/kill" > /etc/sudoers.d/openconnect'
}
function vpnstart() {
gpg --decrypt -a ~/.vpn_pass.gpg 2>/dev/null | sudo openconnect \
--background \
--pid-file="$HOME/.openconnect.pid" \
@elijahc
elijahc / nvidia-docker2-deploy-ubuntu-16.04LTS.md
Created September 11, 2018 22:55 — forked from Brainiarc7/nvidia-docker2-deploy-ubuntu-16.04LTS.md
How to correctly install nvidia-docker2 on Ubuntu 16.04LTS

How to install NVIDIA Docker 2 package on Ubuntu and Debian:

If you came to this result (from Google or elsewhere) after realizing that Nvidia-docker's entry on this subject does not result in a working installation, here are the basic steps needed to install this package correctly:

For starters, ensure that you've installed the latest Docker Community edition by following the steps below:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

@elijahc
elijahc / keras_clear_gpu_mem.py
Last active September 4, 2018 15:43
Clearing gpu memory once a computation is complete when using keras
# Inspired by
# http://forums.fast.ai/t/tip-clear-tensorflow-gpu-memory/1979
# https://github.com/tensorflow/tensorflow/issues/1578#issuecomment-200544189
import keras.backend as K
def limit_mem():
K.get_session().close()
cfg = K.tf.ConfigProto()
cfg.gpu_options.allow_growth = True
K.set_session(K.tf.Session(config=cfg))
@elijahc
elijahc / timelapse.md
Created August 31, 2018 05:59 — forked from alexellis/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality

ACTION=="add"
KERNEL=="sd?1", \
ATTRS{busnum}=="3", \
ATTRS{devpath}=="2", \
ENV{mount_point}=df "$env{DEVNAME}" | tail -1 | awk '{ print $6}'
SYMLINK+="bak_src", \
RUN+="/bin/rm /media/bak_src", RUN+="/bin/ln -s $env{mount_point} /media/bak_src"
ACTION=="remove"
KERNEL=="sd?1", \