Skip to content

Instantly share code, notes, and snippets.

View widoyo's full-sized avatar

Widoyo widoyo

View GitHub Profile
/**************************************************************
*
* primabot Davis Sensor Reader
*
* target prosesor: Atmega 328p
*
* Widoyo
* 20 Okt 2020
*
**************************************************************/
#define library and main variable
import MySQLdb
from urllib2 import urlopen
import urllib2
import requests
import time
import json
def push_notifikasi(wilayah,stasiun,tanggal,jam,ch,status,state):
tanggal_jam = str(tanggal) + " " + str(jam)
data = {
$def with (ctx)
$ kegiatan = ctx.get('kegiatan')
$ pos = ctx.get('pos')
$ petugas = ctx.get('petugas')
$ tg = ctx.get('tgl')
$code:
haris = [h.title() for h in "sen_sel_rab_kam_jum_sab_min".split('_')]
bulan = [b.title() for b in "jan_feb_mar_apr_mei_jun_jul_ags_sep_okt_nop_des".split('_')]
$var extra_header:
<style>
@widoyo
widoyo / soma.yaml
Last active June 3, 2023 03:46
Family Tree of Soma Pawiro
'Somarejan':
- 'mBokde Gembong':
- Mitro + :
- Tuminah
- Wardi
- Sri
- Wi
- Hadi Saimin
- Kenthut
- Yatman
@widoyo
widoyo / anomaly_recomended.py
Created May 21, 2018 22:46
Temukan Saran Data ketika ketemu data anomaly
#Anomali Data Detection
import pandas as pd
#----------Data Preparation
df = pd.read_csv("E:/2.KULIAH/KP2_BBWS/DEBIT/tma_wonogiri.csv",header=None)
#colNaming
df.columns = ["DATE", "TIME", "OLD_VAL"]
#Combine column
df["DATETIME"] = df["DATE"].map(str) + " " + df["TIME"]
@widoyo
widoyo / anomaly_detect.py
Last active May 22, 2018 23:20
Pencari data Anomali
def anomaly_detect(nama_pos, sampling_awal, sampling_akhir):
'''Return [('SamplingDate', 'SamplingTime', oldval, newval)]'''
pass
if __name__ == "__main__":
anomaly_detect('dengkeng', '2016-01-01', '2016-01-31')
@widoyo
widoyo / main.py
Last active March 12, 2017 05:45
MarketPlace Stats
# -*- coding: utf-8 -*-
from urllib2 import urlopen
from HTMLParser import HTMLParser
products = open('produk.txt').readlines()
STATS_START = '<dl class=\'c-deflist\''
STATS_END = '</dl>'
@widoyo
widoyo / PrintFloat.cc
Created April 13, 2016 20:56
PrintFloat, Arduino/Genuino
// printFloat prints out the float 'value' rounded to 'places' places after the decimal point
void printFloat(float value, int places) {
// this is used to cast digits
int digit;
float tens = 0.1;
int tenscount = 0;
int i;
float tempfloat = value;
// make sure we round properly. this could use pow from <math.h>, but doesn't seem worth the import
def create_num(num):
'''
Script Pythonfu untuk Gimp
'''
img = gimp.Image(384, 160, 1)
pdb.gimp_context_push()
text_layer = pdb.gimp_text_fontname(img, None, 60, 0, num, -1, True, 142, 0, "Ubuntu Bold Italic")
pdb.gimp_layer_resize_to_image(text_layer)
layer = pdb.gimp_image_flatten(img)
pdb.file_png_save_defaults(img, layer, "/tmp/%s.png" % num, "/tmp/%s.png" % num)
@widoyo
widoyo / publish.html
Last active August 29, 2015 14:10
Demo pubnub Kuliah Umum Informatika UNS
<!doctype>
<html>
<head>
<!-- Include the PubNub Library -->
<script src="https://cdn.pubnub.com/pubnub.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Instantiate PubNub -->
<script type="text/javascript">