Skip to content

Instantly share code, notes, and snippets.

@amitsaha
amitsaha / livemedia-creator.log
Created May 26, 2012 00:21
livemedia-creator log
[root@zion gsoc]# livemedia-creator --make-iso --ks fedora-livemedia.ks --iso /tmp/boot2.iso
2012-05-26 00:57:02,522: disk_size = 5GB
2012-05-26 00:57:02,522: disk_img = /tmp/disk6fZizy.img
2012-05-26 00:57:02,522: install_log = /home/gene/gsoc/virt-install.log
WARNING KVM acceleration not available, using 'qemu'
Starting install...
Retrieving file vmlinuz... | 8.8 MB 00:00 ...
Retrieving file initrd.img... | 45 MB 00:00 ...
Creating storage file disk6fZizy.img | 5.0 GB 00:00
@amitsaha
amitsaha / vsftpd-anon.conf
Created June 6, 2012 10:22
Simple configuration file for Anonymous only access to VSFTPD
#
# Sample anonymous FTP server configuration
#
# Mandatory directives
#
listen=YES
local_enable=NO
anonymous_enable=YES
anon_mkdir_write_enable=YES
anon_upload_enable=YES
@amitsaha
amitsaha / func_sentinel.py
Created June 26, 2012 07:52
Using Decorators for implementing Function Sentinels
#!/usr/bin/python
#decorator function
def sentinel(lst,integer):
def wrap(f):
def wrapped_f(*args):
if args[0].__class__ is list and args[1].__class__ is int:
print 'Valid call to {0:s}'.format(f.func_name)
f(args[0],args[1])
else:
@amitsaha
amitsaha / memoize.py
Created June 27, 2012 09:13
Simple Memoization demo using Python decorators
''' Simple Memoization demonstration using decorators'''
#dictionary
global cached
cached = {}
def cache(n):
def wrap(f):
def wrapped_f(*args):
global cached
@amitsaha
amitsaha / config_dict.py
Created July 7, 2012 07:00
Dumps a Config file into a Python dictionary
''' Dumps a config file of the type readable by ConfigParser
into a dictionary
Ref: http://docs.python.org/library/configparser.html
'''
import sys
import ConfigParser
class GetDict:

tmux cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@amitsaha
amitsaha / Sample session Output
Created August 7, 2012 02:28
Nested Fabric tasks
[gene@zion64 ~]$ fab -f /home/gene/fabfile.py host1task
[root@10.0.0.9] Executing task 'host1task'
[root@10.0.0.9] Login password for 'root':
[root@10.0.0.9] put: /home/gene/fabfile1.py -> /tmp/fabfile1.py
[root@10.0.0.9] run: fab -f /tmp/fabfile1.py host2task
[root@10.0.0.9] out: [root@10.0.0.27] Executing task 'host2task'
[root@10.0.0.9] out: [root@10.0.0.27] run: uname -a
[root@10.0.0.9] out: [root@10.0.0.27] Login password for 'root':
[root@10.0.0.9] out: [root@10.0.0.27] out: Linux zion64 3.5.0-2.fc17.x86_64 #1 SMP Mon Jul 30 14:48:59 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
@amitsaha
amitsaha / celery_task.log
Created August 10, 2012 06:53
celery 3.0 error on Fedora 16
[2012-08-10 16:50:13,041: WARNING/MainProcess] celery@f16i386 has started.
[2012-08-10 16:50:19,323: ERROR/MainProcess] Unrecoverable error: Exception('Framing Error, received 0x75 while expecting 0xce',)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/celery/worker/__init__.py", line 353, in start
component.start()
File "/usr/lib/python2.7/site-packages/celery/worker/consumer.py", line 369, in start
self.consume_messages()
File "/usr/lib/python2.7/site-packages/celery/worker/consumer.py", line 450, in consume_messages
readers[fileno](fileno, event)
File "/usr/lib/python2.7/site-packages/kombu/connection.py", line 195, in drain_nowait
@amitsaha
amitsaha / picloud_futures.py
Created August 22, 2012 08:43
PiCloud to concurrent.futures API mapping
from concurrent.futures import _base
import cloud
class PiCloudExecutor(_base.Executor):
def __init__(self, max_workers):
"""Initializes a new PiCloudExecutor instance."""
pass
def submit(self, fn, *args, **kwargs):
f = _base.Future()
@amitsaha
amitsaha / cal.py
Created August 23, 2012 12:48
Python Calendar module use demo (also uses clint, argparse)
#!/usr/bin/python
""" Example use of the calendar module
http://docs.python.org/dev/library/calendar.html
Uses clint for p(r)etty coloring
https://github.com/kennethreitz/clint.
Will silently ignore if not installed
and so no colors for you.