Skip to content

Instantly share code, notes, and snippets.

@damico
damico / test-rocm.py
Created April 10, 2023 18:54
Script for testing PyTorch support with AMD GPUs using ROCM
import torch, grp, pwd, os, subprocess
devices = []
try:
print("\n\nChecking ROCM support...")
result = subprocess.run(['rocminfo'], stdout=subprocess.PIPE)
cmd_str = result.stdout.decode('utf-8')
cmd_split = cmd_str.split('Agent ')
for part in cmd_split:
item_single = part[0:1]
item_double = part[0:2]
@carljm
carljm / postactivate
Created July 12, 2011 18:21
Yo dawg, I heard you like Ruby...
#!/bin/bash
# This hook is run after every virtualenv is activated.
export OLD_GEM_HOME=$GEM_HOME
export GEM_HOME=$VIRTUAL_ENV/gems/
export GEM_PATH=
export PATH=$VIRTUAL_ENV/gems/bin:$PATH
@karmi
karmi / nginx-elasticsearch-proxy.conf
Created May 23, 2011 08:16
Route requests to ElasticSearch to authenticated user's own index with an Nginx reverse-proxy
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost:8080/_search?q=*
#
# is rewritten to:
#
@jupiterjs
jupiterjs / ListsAndJavaScriptMVC.js
Created February 8, 2011 00:18
Creating a todo list with JavaScriptMVC
// a helper for retrieving JSON data from localStorage
var localStore = function(name, cb, self){
var data = $.evalJSON( window.localStorage[name] || (window.localStorage[name] = "{}") ),
res = cb.call(self, data);
if(res !== false){
window.localStorage[name] = $.toJSON(data);
}
};
// A todo model for CRUDing todos.
@winhamwr
winhamwr / gist:205450
Created October 8, 2009 21:55
Celery /etc/init.d script to keep celeryd running
#!/bin/sh
USER=%(user)s
NAME=celeryd
VIRTUALENV=%(virtualenv_dir)s
PROJECT_ROOT=%(project_root)s
DAEMON=$VIRTUALENV/bin/celeryd
PIDFILE=$PROJECT_ROOT/$NAME.pid
LOGFILE=$PROJECT_ROOT/$NAME.log