Skip to content

Instantly share code, notes, and snippets.

View samuell's full-sized avatar
💻
Hacking away

Samuel Lampa samuell

💻
Hacking away
View GitHub Profile
@samuell
samuell / gist:1481973
Created December 15, 2011 17:29
SQL Test Errors on iRODS 3.0 install on Ubutnu 11.10 (32bit) (3.0 with path from bug 143)
Finishing the iRODS setup
------------------------------------------------------------------------
Thu Dec 15 18:25:55 2011
Script:
Script: ./scripts/perl/finishSetup.pl
CWD: /home/samuel/opt/irods
Perl:
Perl path: /usr/bin/perl
@samuell
samuell / gist:1487037
Created December 16, 2011 17:34
[Dirty hack] Create links for all globus packages in /usr/lib64
#!/bin/bash
for f in `find /usr/lib64/*globus* -type l|sed -r 's|.*\/||g'`;
do
ln -s $f `echo $f|sed -r 's/\.[0-9]$//g'`;
done
@samuell
samuell / CommandLineOptions.py
Created January 17, 2012 15:55
Parse command line options in python
from optparse import OptionParser
# \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# Parse command line options
# \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
parser = OptionParser()
parser.add_option("-a", "--theaflag", dest="theaflag", type="string",
help="Helpstring, with THEAFLAG", metavar="THEAFLAG")
parser.add_option("-b", "--theaflag", dest="thebflag",
@samuell
samuell / set_python_main_method.py
Created May 24, 2012 23:02
Set the main function to be executed for a python script
#!/usr/bin/python
def main():
pass
if __name__ == "__main__":
main()
@samuell
samuell / fabfile_boilerplate.py
Created May 24, 2012 23:04
Import Some Oftly used stuff for Python Fabric
from fabric.api import *
from fabric.contrib.files import *
from fabric.contrib.console import *
from os import path
import re
def do_stuff():
# Do stuff ...
pass
@samuell
samuell / .vimrc.python
Created June 12, 2012 11:13
vimrc settings to use vim as a python ide
set nocompatible
syntax on
set showmatch
set ignorecase
set showmode
set ts=4
set sw=4
set autoindent
set smartindent
set number
@samuell
samuell / loop_over_key_val_on_arr.py
Created August 15, 2012 13:22
Loop over keys and values of an array in python
my_arr = ["ugh", "cough", "humm"]
for key, value in enumerate(my_arr):
print "%s : %s" % (key, value)
@samuell
samuell / cmds_with_subprocess.py
Created August 17, 2012 15:05
Simple command execution with output with subprocess
from subprocess import *
output = check_output(["ls", "-l"])
print(output)
@samuell
samuell / filter_list.py
Created August 17, 2012 16:11
Compact list filter code in python
mylist = ["Hej", "jag", "heter", "Samuel"]
m = [p for p in mylist if p.islower()]
@samuell
samuell / .vimrc
Created August 22, 2012 10:07
Some .vimrc settings
set nocompatible
syntax on
set showmatch
set ignorecase
set showmode
set ts=4
set sw=4
set autoindent
set smartindent
set number