Skip to content

Instantly share code, notes, and snippets.

View goFrendiAsgard's full-sized avatar

Go Frendi Gunawan goFrendiAsgard

View GitHub Profile
@goFrendiAsgard
goFrendiAsgard / SOS.c
Created March 17, 2015 04:10
Atmega 16L, SOS Morse
#define F_CPU 1000000
#include <avr/io.h>
#include <util/delay.h>
int morse_s(){
PORTB = 0xb0000001;
_delay_ms(250);
PORTB = 0xb0000000;
_delay_ms(250);
PORTB = 0xb0000001;
@goFrendiAsgard
goFrendiAsgard / isil_keyword.py
Created November 18, 2015 13:30
Anonymous's should be better script?
#!/usr/bin/python
# -*- coding: utf-8 -*-
str_list = [
"media Mujahideen" ,
"Media Alblattform (swivel" ,
"Media Alblattform" ,
"Media Zahra" ,
"Al-Qaeda in the Islamic Maghreb" ,
"Al-Qaeda in the Islamic Maghreb: Media Andalusia" ,
"rule: forum redemption" ,
@goFrendiAsgard
goFrendiAsgard / find-the-way-bruteforce-version.py
Last active February 19, 2016 09:34
Brute Force to find the way (not recommended for large mesh, but good enough lah for prototype :v)
# The settings
NODES = ["A", "B", "C", "D", "E", "F", "G", "H", "I"]
EDGES = {
"A" : [("B", 5), ("D", 7)],
"B" : [("A", 5), ("C", 3), ("E",4)],
"C" : [("B", 3), ("F", 10)],
"D" : [("A", 7), ("E", 1), ("G", 4)],
"E" : [("B", 4), ("D", 1), ("F", 4),("H", 3)],
"F" : [("C", 10), ("E", 4), ("I", 8)],
"G" : [("D", 4), ("H", 2)],
@goFrendiAsgard
goFrendiAsgard / manhattan_distance_a_star.pas
Created March 15, 2016 23:27
Manhattan Distance implementation for A * algorithm in grid map
Uses sysutils;
type
integer_array = array of integer;
integer_array_2d = array of integer_array;
var
closed_row, openned_row, closed_col, openned_col : integer_array;
map, previous_rows, previous_cols, fs, gs : integer_array_2d;
height, width, row, col, current_row, current_col, start_row, end_row, start_col, end_col, up_row, bottom_row, left_col, right_col, f, g, h, i, best_f, prev_row, prev_col, counter : integer;
solution_found : boolean;
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Description of Manage_purchase_invoice
*
* @author No-CMS Module Generator
*/
class Manage_purchase_invoice extends CMS_CRUD_Controller {
protected $URL_MAP = array();
@goFrendiAsgard
goFrendiAsgard / gosolarized.vim
Created August 4, 2016 05:06
solarized colorscheme for vim with higher contrast and without red
" Vim color file - gosolarized
" Generated by http://bytefluent.com/vivify 2016-08-03
set background=dark
if version > 580
hi clear
if exists("syntax_on")
syntax reset
endif
endif
@goFrendiAsgard
goFrendiAsgard / gomodorokanbanreminder.py
Last active March 4, 2017 14:03
Go Frendi's pomodoro, kanban, and reminder application. Work on terminal, written by using Python
#!/usr/bin/env python
'''
Kanban + Pomodoro + Reminder
If you use linux please install sox first (sudo apt-get install sox)
You can use these formats in order to remind you of the tasks:
* Y:m:d H:M:S
* Y:m:d H:M
* everyday H:M[:S]
* every [monday|tuesday|wednesday|thursday|friday|saturday] H:M[:S]
* *:m:d H:M[:S]
#include <iostream>
#include <math.h>
using namespace std;
int get_digit(int angka, int digit){
int divider = 1;
for(int i=0; i<digit; i++){
divider *= 10;
}
@goFrendiAsgard
goFrendiAsgard / php-magic.php
Created December 31, 2016 14:52
Some magic on PHP to celebrate 2017 new year eve
<?php
/* Created on Mudawikawi's laptop on 2017 new year eve, to show you miracle */
class Mutant{
function __get($property)
{
if($property == 'a')
{
if(property_exists($this, 'get_a'))
{
@goFrendiAsgard
goFrendiAsgard / biarBerhentiBerantem.js
Created May 28, 2017 10:39
Biar mahasiswaku berhenti berantem
/* Instruksi: Buka tab baru, tekan ctrl + shift + i, klik tab "console", lalu copy-paste kan kode berikut */
let kalimatKonyol = "Tono adalah programmer yang sempurna. Jika program buatan Tono salah, salahkan programnya, jangan salahkan Tono. Tono itu sempurna, tapi program buatan Tono tidak";
window.alert("Contoh kalimat konyol: " + kalimatKonyol);
/* Contoh penggunaan regex di javascript: */
kalimatKonyol = kalimatKonyol.replace(/program buatan Tono/g, 'saya').replace(/Tono/g, 'Agama saya').replace(/programmer/g, 'agama').replace(/program/g, 'saya');
window.alert("Kalimat dengan pola yang sama: " + kalimatKonyol);
/* Apa yang bikin anda baper? */