Skip to content

Instantly share code, notes, and snippets.

View achimnol's full-sized avatar

Joongi Kim achimnol

View GitHub Profile
@achimnol
achimnol / cuda.conf
Last active September 25, 2016 15:32
An upstart configuration for NVIDIA CUDA device initialization without X environments (derived from Sangjin Han's init.d script)
description "CUDA initialization without X environments"
start on runlevel [2345]
stop on runlevel [!2345]
pre-start script
DRIVER=nvidia
HOLD_GPU=/usr/local/bin/hold_gpu.py
[ -x "$HOLD_GPU" ] || { echo "$HOLD_GPU is missing or not executable!"; exit 1; }
@achimnol
achimnol / sqlite_backup.py
Created June 30, 2012 03:13
A simple and safe SQLite3 backup script written in Python using ctypes + sqlite3 online backup API
#! /usr/bin/env python
# Of course, the author does not guarantee safety.
# I did my best by using SQLite's online backup API.
from __future__ import print_function
import sys, ctypes
from ctypes.util import find_library
SQLITE_OK = 0
SQLITE_ERROR = 1
SQLITE_BUSY = 5
@achimnol
achimnol / convert-pwd-to-ldap.py
Created June 25, 2012 18:54
Some helper tools for LDAP account management
#! /usr/bin/env python
# --*-- encoding: utf8 --*--
from __future__ import print_function
import pwd, spwd, grp
# TODO: add arguments
if __name__ == '__main__':
processed_userids = set()