Skip to content

Instantly share code, notes, and snippets.

View initrunlevel0's full-sized avatar

Putu Wiramaswara Widya initrunlevel0

View GitHub Profile
@initrunlevel0
initrunlevel0 / generator.py
Created February 18, 2018 00:10
Buku Angkatan Generator
# Pic Downloader
import urlparse, requests, shutil, os
def pic_downloader(gdrive_link, output):
parsed = urlparse.urlparse(gdrive_link)
id = urlparse.parse_qs(parsed.query)["id"][0]
new_gdrive_link = "https://docs.google.com/uc?export=download&id=" + str(id)
path = "img/" + output
if not os.path.isfile(path):
print "Downloading for " + output
response = requests.get(new_gdrive_link, stream=True)
@initrunlevel0
initrunlevel0 / c1-fetcher.py
Created July 11, 2014 06:18
Skrip pengambil data C1 KPU lembar ke-4
import requests
import base64
def ambil_c1(id_kelurahan, id_tps):
r = requests.get('http://scanc1.kpu.go.id/viewp.php?f=' + str(id_kelurahan).zfill(7) + str(id_tps).zfill(3) + '04.jpg')
content_type = r.headers['content-type']
if(content_type == "text/html"):
return None
else:
id_to_print = str(id_kelurahan).zfill(7) + str(id_tps).zfill(3)
@initrunlevel0
initrunlevel0 / README
Created April 18, 2014 05:13
rtbth (RT3290 Bluetooth Driver) in Linux >= 3.13 Patch
# rtbth patch for Kernel >= 3.13
Putu Wiramaswara Widya <putu@wirama.web.id>
## Howto
Use this thing with http://ppa.launchpad.net/barracuda72/ralink/ubuntu/pool/main/r/rtbth-dkms/rtbth-dkms_3.9.3-0ubuntu1~ppa3.tar.gz. Patch with this command line :
$ patch < rtbth_core_bluez.c.patch
@initrunlevel0
initrunlevel0 / read-iwlist-scan.py
Created March 24, 2014 10:30
A script to classify WLAN AP data from "iwlist scan" output
import sys
if len(sys.argv) < 2:
exit(1)
file = sys.argv[1]
cells = []
new_cell = {}
f = open(file)
@initrunlevel0
initrunlevel0 / penugasan-jee-kedua
Last active December 31, 2015 19:59
Penugasan Tim JEE ke #2
### Penugasan Proyek SimplePOS2013 Ke-2
Mulai: 19 Desember 2013 16:53 UTC+7
Selesai: 20 Desember 2013 23:45 UTC+7
Silahkan implementasikan layanan/service dari laman wiki https://github.com/initrunlevel0/SimplePOS2013_Gudang/wiki/Implementasi-layanan-backoffice pada paket id.ac.its.SimplePOS2013.Gudang.ServiceBO.
Setiap service dibuat dalam dua bentuk: Interface dan Implementasinya (lihat kelas Barang sebagai contoh dasar).
Pembagian Tugasnya silahkan dideklarasikan sendiri melalui komentar Issue: https://github.com/initrunlevel0/SimplePOS2013_Gudang/issues/3.
@initrunlevel0
initrunlevel0 / program-arduino.cpp
Created December 17, 2013 06:38
Kode Konsep Arduino board untuk menghidupkan/mematikan lampu via SMS. Karena yang buat tidak mampu membeli GSM Shield, maka dia akhirnya menggunakan laptop untuk membaca SMS nya via Gammu.
char incomingByte = NULL;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT); // Gunakan pin 19 sebagai digital output ke lampu
}
void loop() {
if (Serial.available() > 0) {
// Baca perintah byte untuk On/Off
@initrunlevel0
initrunlevel0 / ford-fulkerson.py
Created December 11, 2013 16:18
Maximum Flow dengan algoritma Ford-Fulkerson. Menggunakan python-graph: http://code.google.com/p/python-graph/
from pygraph.classes.digraph import digraph
dgr = digraph() # Graph
flow = {}
# Semacam DFS
def find_path(source, sink, path):
global flow
if(source == sink):
@initrunlevel0
initrunlevel0 / klien.py
Created November 28, 2013 12:31
Tugas 1 Progjarnya Pak Wahyu
import socket
import sys
import os
from math import floor
from datetime import datetime
if(len(sys.argv) < 4):
print "python.py ./klien-getfile.py <address> <port> (get/ls) <path>"
else:
HOST = sys.argv[1]
# Viewpoint Datalabs International, Inc. Copyright 1996
mtllib ./vp.mtl
g
v 0.000000 8.407028 0.000000
v 0.000000 8.380042 -0.204985
v 0.053054 8.380042 -0.198000
v 0.102492 8.380042 -0.177522
@initrunlevel0
initrunlevel0 / tugas-4.cpp
Created November 28, 2013 12:27
Huawei EC306-2 dengan OpenGL (Tugas 4 Mata Kuliah Grafkom)
#include <GL/glut.h>
#include <math.h>
#include <stdio.h>
#define PI 3.14
const float DEG2RAD = 3.14159/180;
double rotate_x=0, rotate_y=0;
void display() {
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glClearColor(1.0, 0.9, 0.0, 1.0);