Skip to content

Instantly share code, notes, and snippets.

View lol97's full-sized avatar
🏠
Working from home

Warteg Dust lol97

🏠
Working from home
  • DKI Jakarta, Indonesia
View GitHub Profile
@lol97
lol97 / greedyCase1.py
Last active April 17, 2018 19:35
Greedy Algorithm Knapsack Problem
from operator import itemgetter, attrgetter
w = [3,4,1,7,6,8,9]
p = [4,5,2,5,5,8,11]
item = [[3,4],[4,5],[1,2],[7,5],[6,5],[8,8],[9,11]]
i=0
while i<len(item):
hasil = item[i][1]/item[i][0]
item[i].append(hasil)
i += 1
@lol97
lol97 / linearRegressionSederhana.py
Created May 4, 2018 10:03
Make Graph to Simple Linear Regression, y=laba; x=keuntungan.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
style.use("ggplot")
keuntungan = [7000000, 10000000, 7500000, 5000000, 17000000, 7000000, 14000000]
laba = [3000000, 4000000, 2000000, 1200000, 5000000, 2000000, 5000000]
def linearRegresion(data):
'''
indeks[0] -> response variable -> x
@lol97
lol97 / Brightness
Created May 19, 2018 17:48
Image Processing Brightness
private void button1_Click(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(pictureBox1.Image);
Bitmap bmp2 = new Bitmap(pictureBox1.Image);
int r, g, b;
Color c;
int val = (int)Convert.ToInt16(textBox1.Text);
Cursor = Cursors.WaitCursor;
for(int i=0; i < bmp.Width; i++)
{
@lol97
lol97 / monitoringMoistureSensor.ino
Created June 13, 2018 04:26
Source code untuk monitoring 3 sensor kelembaban tanah
/*Sufyan Saori
xsufyan@gmail.com
Log Data Moisture Sensor V.0.001*/
#include <TimeLib.h>
#define PIN1 A0
#define PIN2 A1
#define PIN3 A2
#define PIN4 A3
@lol97
lol97 / GraphMoistureSensor.py
Created June 13, 2018 04:44
For Make Graph
'''
Source Code For Make Graph from data sensor
xsufyan@gmail.com / github.com/lol97
'''
import matplotlib.pyplot as plt
import numpy as np
time,s1,s2,s3,t,ku,ic = np.loadtxt('hasil1.1.txt',dtype='str',delimiter=';',unpack=True)
s1 = s1.astype(np.int)
s2 = s2.astype(np.int)
@lol97
lol97 / testTextEditor.ino
Created June 18, 2018 12:53
Test code for print serial monitor and variabel
void setup()
{
Serial.begin(9600);
Serial.println("Check Arduino with Sublime");
delay(1000);
}
int i = 0;
void loop()
{
@lol97
lol97 / trapezioda.py
Created June 20, 2018 14:18
Get Area of Graph with riemann methode
'''
Trapezioda Integral
Sufyan Saori
xsufyan@gmail.com
'''
x = [0, 0.2, 0.4, 0.6, 0.8, 1.0]
y = [2, 3, 6, 5, 4, 1]
def trapezioda(x,y):
@lol97
lol97 / pascal.sublime-build
Created June 22, 2018 03:11
Pascal Build Setting at Sublime Text 3
{
"shell": true,
"cmd": ["fpc", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "$file_base_name.exe", "&", "pause"],
"selector": "source.pascal",
"variants": [
{
"cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"],
"name": "Run",
"shell": true
},
@lol97
lol97 / linearSearch.py
Created June 22, 2018 14:08
Lakad Matatag
def linearSeach(data,key):
for i in range(len(data)):
if data[i] == key:
return i
return -1
def makeList(lenData):
data = []
for x in range(lenData):
lol = int(input())
#include <I2Cdev.h>
#include <MPU6050.h>
#include <Wire.h>
MPU6050 gy_521;
int16_t ax, ay, az;
int16_t gx, gy, gz;
int ACCX,ACCY;
int GYRX,GYRY,GYRZ,sensitif;