Skip to content

Instantly share code, notes, and snippets.

View lol97's full-sized avatar
🎯
Focusing

Warteg Dust lol97

🎯
Focusing
  • DKI Jakarta, Indonesia
View GitHub Profile
interface Hello {
public String getHelloFormal();
}
class Greeting {
//definisikan anonymous class
Hello helloBahasaIndonesia = new Hello(){
public String getHelloFormal(){
return "Selamat pagi";
}
#!/bin/bash
#filename backup
fileName= db_retail_bck_$(date +%Y%m%d).log
path='/home/user/backup'
fullPath=${path}/${fileName}
echo ${fileName}
echo ${path}
echo ${fullPath}
class Rectangle:
def __init__(self, length, width):
self._length = length
self._width = width
# Check the invariant after initializing the attributes
self._check_invariant()
def _check_invariant(self):
# Invariant: Both length and width must be positive
if self._length <= 0 or self._width <= 0:
public class BankAccount {
private double balance;
// Invariant: balance tidak boleh negatif.
private void checkInvariant() {
if (balance < 0) {
throw new IllegalStateException("Invariant violation: Balance cannot be negative.");
}
}
{
"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 / Stratified K-Fold
Last active January 7, 2020 07:41
Cross-Validation
from sklearn import datasets
from sklearn.model_selection import StratifiedKFold
from sklearn.svm import LinearSVC
iris = datasets.load_iris()
features = iris.data
labels = iris.target
skf = StratifiedKFold(n_splits=5)
"""
kode untuk menghitung total produksi
dengan pabrik defisit tiap tahun 0.2 dari sebelumnya
"""
tahun_pertama = 98000
total_produksi = tahun_pertama
sisa = tahun_pertama
catatan_tahun = {}
"""
cara membaca data dari serial Monitor arduino
"""
# library / package yang dibutuhkan
import serial
# membuat koneksi
con = serial.Serial("COM6", 9600)
print(con)
@lol97
lol97 / contoh.php
Created July 12, 2019 06:42
reviews
ini di model User
public function terimaReviews()
{
return $this->hasMany('App/Review', 'id_penerima', 'id');
}
public function kirimReviews()
{
return $this->hasMany('App/Review', 'id_pengirim', 'id');
}
@lol97
lol97 / detect_cat_face.py
Created May 5, 2019 19:29
Code Iseng #1
'''
Cat Faces Detection
Sufyan Saori
'''
import cv2
cascade_path = "..." #change to your cascade path
cat_cascade = cv2.CascadeClassifier(cascade_path)