Skip to content

Instantly share code, notes, and snippets.

View khrlimam's full-sized avatar

Khairul Imam khrlimam

View GitHub Profile
var omTeloletOm = {
lowBoundFreq: 300, //initial frequency value
upperBoundFreq: 800,
freqState: this.lowBoundFreq,
init: function() {
context = new(window.AudioContext || window.webkitAudioContext)();
oscilator = context.createOscillator();
oscilator.type = 'sawtooth';
oscilator.frequency.value = this.lowBoundFreq;
gain = context.createGain();
#!/usr/bin/python3
import requests
import os
import argparse
import shutil
def download():
ap = argparse.ArgumentParser()
ap.add_argument('-u', '--username', required=True, help='username yout want to download')
ap.add_argument('-d', '--directory', required=False, help='Directory location for images')
@khrlimam
khrlimam / rgb_color_channel.py
Last active January 7, 2017 10:50
Here is the snippet i use in https://web.facebook.com/notes/khairul-imam/rgb-color-channel-quick-glance/519312241608587. No need to create a new file, you can use IPython just to test the code. Make sure you have numpy, scipy, matplotlib installed in your virtualenvironment or computer
import cv2 as cv
from matplotlib import pyplot as plt
#load image
rgb_image = cv.imread('images/bebek_imut.jpg')
#see the output
rgb_image
#print rgb_image's shape
@khrlimam
khrlimam / comparemean.py
Last active January 8, 2017 14:45
Get intuitive of how sample is important to a population data sets
import random
population = [random.randint(70, 100) for n in range(100)]
def comparePopulationMeanAndSampleMean(population, numberOfSample):
populationMean = sum(population)/population.__len__()
random.shuffle(population)
sample = population[:numberOfSample]
sampleMean = sum(sample)/sample.__len__()
print "population mean: %s \nsample mean: %s" % (populationMean, sampleMean)
@khrlimam
khrlimam / ujisimilarity.py
Last active May 24, 2017 02:37
Uji similaritas, this file only works on project dir with activated working environment
from lsirina.lsi.similarity import calc_similarity
d1 = "Shipment of gold damaged in a fire"
d2 = "Delivery of silver arrived in a silver truck"
d3 = "Shipment of gold arrived in a truck"
query = "gold silver truck"
docs = [d1,d2,d3]
tokenized_doc = [d.split() for d in docs]
from numpy.linalg import svd
import numpy
d1 = "Shipment of gold damaged in a fire"
d2 = "Delivery of silver arrived in a silver truck"
d3 = "Shipment of gold arrived in a truck"
docs = [d1,d2,d3]
tokenized_doc = [d.lower().split() for d in docs]

Keybase proof

I hereby claim:

  • I am khyrulimam on github.
  • I am khairulimam (https://keybase.io/khairulimam) on keybase.
  • I have a public key ASB9tQwIEy_EnWa1GCQJw1iRKcDcvDqHsgwAhVBO7m3Gygo

To claim this, I am signing this object:

mkdir build &&
cd build &&
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_CXX11=ON \
-DBUILD_PERF_TESTS=OFF \
-DWITH_XINE=ON \
-DBUILD_TESTS=OFF \
-DENABLE_PRECOMPILED_HEADERS=OFF \
antRoutes = [
[1,2,9,10,25,26],
[4,3,8,11,24,27],
[5,6,7,12,23,28],
[16,15,14,13,22,29],
[17,18,19,20,21,30],
[36,35,34,33,32,31]
];
detik = input('Semut di detik berapa? ')
@khrlimam
khrlimam / v_net_graph.php
Created May 8, 2018 14:33
Laravel Irham
<?php
$data = Model::all();
$graphData = $data->map(function($item, $key) {
return [
'y' => $item->net_lending,
'name' => $item->nama_cab
];
});