Skip to content

Instantly share code, notes, and snippets.

View steveandroulakis's full-sized avatar

Steve Androulakis steveandroulakis

View GitHub Profile
@steveandroulakis
steveandroulakis / read_tardis_edu.py
Last active August 29, 2015 14:13
tardis.edu.au public upload script
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
import mytardis_uploader
import os.path
# steve.androulakis@monash.edu
# Run as root (the LaRDS mytardis_its filestore needs it)
# Turn test=False at the bottom of this script to run
# for real.
@steveandroulakis
steveandroulakis / read_mytardis_its.py
Created January 16, 2015 11:04
Upload public mytardis.its.monash entries not found on tardis.edu.au
# -*- coding: utf-8 -*-
from mytardisuploader import mytardis_uploader
# steve.androulakis@monash.edu
address = 'http://118.138.233.132/'
username = 'mytardis'
password = 'astestdep'
institute = 'Monash University'
test_run = True
@steveandroulakis
steveandroulakis / gist:3779591
Created September 25, 2012 02:16
CherryPy server script
import cherrypy
import subprocess
import os
git_cmd = "/usr/local/git/bin/git"
jekyll_cmd = "/opt/local/bin/jekyll"
swift_cmd = "/usr/local/bin/swift"
site_dir = "_site" #/Users/steve/Documents/git/tjdett/uberdojo-cms/
swift_container = "steve-dojo"
os_auth_url = "http://keystone.rc.nectar.org.au:5000/v2.0/"
#!/bin/bash
HOME_DIR=/home/
for name in $(find $HOME_DIR -maxdepth 1 -mindepth 1 -type d -printf '%f\n')
do
echo "USER = $name"
echo "DIR = $HOME_DIR$name"
WEB_DIR=/home/www/html/home/$name
#WEB_DIR=$name
# use eg. curl -s https://myurl.com/script.sh | bash /dev/stdin
# only run on an empty cloud server with blank vdb volume attached!
sudo apt-get update < "/dev/null"
sudo apt-get install curl -y < "/dev/null"
sudo true
# Install kernel extra's to enable docker aufs support
sudo apt-get -y install linux-image-extra-$(uname -r) < "/dev/null"
# Add Docker PPA and install latest version
#!/bin/bash -i
sudo apt-get update < "/dev/null"
sudo apt-get install python-pip -y < "/dev/null"
sudo pip install awscli < "/dev/null"
# use eg. curl -s https://myurl.com/script.sh | bash /dev/stdin
# only run on an empty cloud server with blank vdb volume attached!
sudo apt-get update < "/dev/null"
sudo apt-get install curl -y < "/dev/null"
sudo true
Getting distribution for 'zc.recipe.egg'.
Got zc.recipe.egg 2.0.0a3.
Getting distribution for 'pyparsing'.
An error occurred when trying to install pyparsing 2.0.0. Look above this message for any errors that were output by easy_install.
STDERR: Traceback (most recent call last):
File "setup.py", line 2, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
Traceback (most recent call last):
File "<string>", line 1, in <module>
@steveandroulakis
steveandroulakis / python fuse-mountable dict
Created April 10, 2013 05:26
Proof of concept that produces a virtual FUSE-mountable file/directory structure from a python dictionary. Uses python-fuse.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Proof of concept that produces a virtual FUSE-mountable
# file/directory structure from a python dictionary
# By Steve Androulakis <http://github.com/steveandroulakis>
# Requires FUSE (linux: use package manager to install)
# Requires python-fuse pip install fuse-python
# USE:
# Mount: ./dict-fuse.py mnt -f
# Unmount: fusermount -u -z mnt
@steveandroulakis
steveandroulakis / gist:5820302
Last active December 18, 2015 17:39
Tag example
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../tag-it/js/tag-it.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/flick/jquery-ui.css">
<link href="../tag-it/css/jquery.tagit.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
$(document).ready(function() {
@steveandroulakis
steveandroulakis / windows process node.js
Last active December 23, 2015 23:29
run windows process in node.js
// pre-req, msconvert.exe in PATH smsdm.cpl
// terminal
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});