Skip to content

Instantly share code, notes, and snippets.

View satriahrh's full-sized avatar

Satria H R Harsono satriahrh

View GitHub Profile
g++ -o bin/kpa-brute-force -std=c++17 ftie/*.h ftie/*.cpp pengujian/kpa_bf.cpp `libpng-config --ldflags`

Data to Test

  • ./bin/kpa-brute-force 3 7 2
  • ./bin/kpa-brute-force 3319 3323 6740748
  • ./bin/kpa-brute-force 7219 7243 5276214
  • ./bin/kpa-brute-force 11503 11519 108853157
  • ./bin/kpa-brute-force 15959 15971 198571272
  • ./bin/kpa-brute-force 20743 20747 3897525
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install git -y
sudo apt-get install gcc-8 g++-8 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50 --slave /usr/bin/g++ g++ /usr/bin/g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8
sudo update-alternatives --config gcc
3 523
523 1259
1259 1987
1987 2791
2791 3623
3623 4483
4483 5351
5351 6199
6199 7079
7079 8123
@satriahrh
satriahrh / histogram.py
Last active March 1, 2018 06:14
Histogram code on github.com/hafizhme/phocode that seems can't affordable on it
from PIL import Image
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('agg')
def do(original_image: Image):
freq = [
[0 for x in range(256)],
[0 for x in range(256)],
def retrieveTree(self, qp, level=0, arr):
"""
INPUT
qp : query point of (x, y)
level : initial level, default set to 0
arr : dataset containing vertices and its list region
OUTPUT
dictionary of {
'nearest': (int, int),
@satriahrh
satriahrh / retrieveTree.py
Last active November 19, 2017 14:56
python code for retrieve tree
def retrieveTree(self, coordinate, level):
if not level % 2:
# genap
if coordinate[0] < self.coordinate[0]:
# kiri
if not hasattr(self, 'left'):
return self.coordinate
return self.left.retrieveTree(coordinate, level+1)
elif coordinate[0] > self.coordinate[0]:
# kanan