Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# Converts rsync log format to xferlog format
# Author: Fajran Iman Rusadi <fajran|ubuntu.com>
# License: Public Domain
import re
import sys
from datetime import datetime
TLP_HOME=/home/iang/apps/tulip-3.1.0
CXXFLAGS=-I$(TLP_HOME)/include
LIBS=-L$(TLP_HOME)/lib -ldl -ltulip
all : to-tulip
to-tulip : to-tulip.cc
g++ -o $@ $? $(CXXFLAGS) $(LIBS)
#!/bin/sh
SOURCES="satu::mod/ dua::mod/ tiga::mod/"
for src in $SOURCES; do
rsync -av $src dst/ && break
done
#!/bin/sh
#
# Create thumbnails of a PDF file
#
# Author: Fajran Iman Rusadi <fajran@gmail.com>
# License: Public domain
# Requirements: poppler-utils imagemagick
#!/bin/bash
# License: public domain
# Usage: ./donlod.sh http://www.megaupload.com/?d=id
WAIT=120
#VIEWER=eog
VIEWER=open
#!/usr/bin/perl
while (<>) {
if (/^re.+p.$/) { # regex sudah menjadi bagian bahasa perl
print; # tidak terlihat jelas apa yang di-print
}
}
<?
// baca data dari data.txt (asumsinya udah ada)
$f = fopen('data.txt', 'rb');
$data = '';
while (!feof($f)) {
$data .= fread($f, 1024);
}
fclose($f);
class Angka(object):
def __init__(self, nilai):
self.nilai = nilai
def berapa(self):
return self.nilai
satu = Angka(1)
print satu.berapa()
@fajran
fajran / gist:814525
Created February 7, 2011 15:23
meta.py
class MetaProvinsi(type):
def __new__(cls, name, bases, attrs):
return type.__new__(cls, name, bases, attrs)
class Provinsi(object):
__metaclass__ = MetaProvinsi
class MetaKabupaten(type):
def __new__(cls, name, bases, attrs):
attrs['nama_kelas'] = name
@fajran
fajran / main.cpp
Created March 1, 2011 10:14
coba.pro
QT =
TARGET = coba
SOURCES += main.cpp
INCLUDEPATH += /usr/include/mpich2
LIBS += /usr/lib/libmpich.a