Skip to content

Instantly share code, notes, and snippets.

View goFrendiAsgard's full-sized avatar

Go Frendi Gunawan goFrendiAsgard

View GitHub Profile
@goFrendiAsgard
goFrendiAsgard / var_dump.py
Last active February 27, 2025 17:45
var_dump implementation in python
# the idea was come from https://gist.github.com/jvanasco/1616707
import types
def _var_dump(variable, depth = 0, not_new_line = False):
padding = " " * 4 * depth
key_padding = " " * 4 * (depth+1)
first_padding = '' if not_new_line else padding
not_new_line = True
depth+= 1
@goFrendiAsgard
goFrendiAsgard / face.py
Created June 19, 2014 05:13
OpenCV-Python haar classifier
import cv2
import numpy as np
c = cv2.VideoCapture(0)
# get the xmls from https://github.com/Itseez/opencv/tree/master/data/haarcascades
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_alt.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
while(1):
@goFrendiAsgard
goFrendiAsgard / reverse-number-set-in-xml.py
Created August 13, 2014 05:25
modify only some part of xml files (will be used for creating new HAAR-Classifier without even do the exhausting training process)
string = '''
<_>
<!-- root node -->
<feature>
<rects>
<_>3 7 14 4 -1.</_>
<_>3 9 14 2 2.</_></rects>
<tilted>0</tilted></feature>
<threshold>4.0141958743333817e-003</threshold>
<left_val>0.0337941907346249</left_val>
@goFrendiAsgard
goFrendiAsgard / gunvarrel 0.0.1
Created December 5, 2014 00:34
Arduino Push-Button & LED
/*
* Gunvarrel v 0.0.1
* Purpose: To emulate simple sonar robot
* Description: Far from perfect. I use LED instead of motor, and push-button instead of sonar
* Author: Go Frendi Gunawan
*/
int left_motor = 12; // left motor (now just LED)
int right_motor = 13; // right motor (now just LED)
int sonar_sensor = 8; // sonar (now just push-button)
@goFrendiAsgard
goFrendiAsgard / gunvarrel 0.0.2
Created December 5, 2014 05:33
Arduino Sonar Sensor & LED
/*
* Gunvarrel v 0.0.2
* Purpose: To emulate simple sonar robot
* Description: Far from perfect. I use LED instead of motor
* Author: Go Frendi Gunawan
*/
int left_motor = 12; // left motor
int right_motor = 13; // right motor
int sonar_trig = 8; // sonar trigger
int sonar_echo = 7; // sonar echo
/*
* Gunvarrel v 0.0.3
* Purpose: Simple sonar robot
* Description: Good enough
* Author: Go Frendi Gunawan
*/
int left_motor = 11; // left motor
int right_motor = 10; // right motor
int sonar_trig = 12; // sonar trigger
int sonar_echo = 13; // sonar echo
@goFrendiAsgard
goFrendiAsgard / get_title_curl.php
Created January 26, 2015 03:55
Get title of another website
<?php
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "gofrendi.dev");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
/*
* Gunvarrel v 0.0.5
* Purpose: Sonar Robot with H-Bridge for smoother rotation
* Description: The robot will move to avoid obstacles
* Author: Go Frendi Gunawan
*/
#include<NewPing.h>
int left_front = 6; // The ports
@goFrendiAsgard
goFrendiAsgard / graph.py
Last active August 29, 2015 14:16
Look for non-loop path in a graph
# Author : Go Frendi Gunawan
# Purpose : Comparing Greedy & BruteForce Algorithm
'''
Graph Structures
'''
START, END = 'A', 'E'
COORDINATE = {
'A' : [0,1],
'B' : [2,0],
@goFrendiAsgard
goFrendiAsgard / atmega_blink.c
Created March 16, 2015 12:34
Blinking atmega