Skip to content

Instantly share code, notes, and snippets.

View ekapujiw2002's full-sized avatar

Eka Puji Widiyanto ekapujiw2002

View GitHub Profile
@ekapujiw2002
ekapujiw2002 / read-rfid-on-rpi.py
Created June 7, 2018 04:21 — forked from softberries/read-rfid-on-rpi.py
RFID reading on raspberry pi
import sys
hid = { 4: 'a', 5: 'b', 6: 'c', 7: 'd', 8: 'e', 9: 'f', 10: 'g', 11: 'h', 12: 'i', 13: 'j', 14: 'k', 15: 'l', 16: 'm', 17: 'n', 18: 'o', 19: 'p', 20: 'q', 21: 'r', 22: 's', 23: 't', 24: 'u', 25: 'v', 26: 'w', 27: 'x', 28: 'y', 29: 'z', 30: '1', 31: '2', 32: '3', 33: '4', 34: '5', 35: '6', 36: '7', 37: '8', 38: '9', 39: '0', 44: ' ', 45: '-', 46: '=', 47: '[', 48: ']', 49: '\\', 51: ';' , 52: '\'', 53: '~', 54: ',', 55: '.', 56: '/' }
hid2 = { 4: 'A', 5: 'B', 6: 'C', 7: 'D', 8: 'E', 9: 'F', 10: 'G', 11: 'H', 12: 'I', 13: 'J', 14: 'K', 15: 'L', 16: 'M', 17: 'N', 18: 'O', 19: 'P', 20: 'Q', 21: 'R', 22: 'S', 23: 'T', 24: 'U', 25: 'V', 26: 'W', 27: 'X', 28: 'Y', 29: 'Z', 30: '!', 31: '@', 32: '#', 33: '$', 34: '%', 35: '^', 36: '&', 37: '*', 38: '(', 39: ')', 44: ' ', 45: '_', 46: '+', 47: '{', 48: '}', 49: '|', 51: ':' , 52: '"', 53: '~', 54: '<', 55: '>', 56: '?' }
fp = open('/dev/hidraw0', 'rb')
ss = ""
shift = False
done = False
while not done:
@ekapujiw2002
ekapujiw2002 / AsyncWebUpdate.ino
Created May 4, 2018 07:57 — forked from JMishou/AsyncWebUpdate.ino
ESPAsyncWebServer webupdate
/*
__/\\\\____________/\\\\__/\\\\\\\\\\\_____/\\\\\\\\\\\____/\\\________/\\\_
_\/\\\\\\________/\\\\\\_\/////\\\///____/\\\/////////\\\_\/\\\_______\/\\\_
_\/\\\//\\\____/\\\//\\\_____\/\\\______\//\\\______\///__\/\\\_______\/\\\_
_\/\\\\///\\\/\\\/_\/\\\_____\/\\\_______\////\\\_________\/\\\\\\\\\\\\\\\_
_\/\\\__\///\\\/___\/\\\_____\/\\\__________\////\\\______\/\\\/////////\\\_
_\/\\\____\///_____\/\\\_____\/\\\_____________\////\\\___\/\\\_______\/\\\_
_\/\\\_____________\/\\\_____\/\\\______/\\\______\//\\\__\/\\\_______\/\\\_
_\/\\\_____________\/\\\__/\\\\\\\\\\\_\///\\\\\\\\\\\/___\/\\\_______\/\\\_
_\///______________\///__\///////////____\///////////_____\///________\///__
@ekapujiw2002
ekapujiw2002 / curl.md
Created March 16, 2018 02:37 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

# Posted at http://dl.dropbox.com/u/18371907/asoundrc
# Info: http://www.sabi.co.uk/Notes/linuxSoundALSA.html
# Soundcard roundup: http://forums.gentoo.org/viewtopic-p-4192284.html#4192284
# Show programs currently opening ALSA:
# fuser -fv /dev/snd/* /dev/dsp*
# Show opened settings:
# cat /proc/asound/card0/pcm0p/sub0/hw_params
@ekapujiw2002
ekapujiw2002 / jdutil.py
Created April 26, 2017 08:42 — forked from jiffyclub/jdutil.py
Functions for converting dates to/from JD and MJD
"""
Functions for converting dates to/from JD and MJD. Assumes dates are historical
dates, including the transition from the Julian calendar to the Gregorian
calendar in 1582. No support for proleptic Gregorian/Julian calendars.
:Author: Matt Davis
:Website: http://github.com/jiffyclub
"""
@ekapujiw2002
ekapujiw2002 / julian.c
Created April 26, 2017 08:01 — forked from rikusalminen/julian.c
Convert to/from Julian date numbers
int julian(int y, int m, int d) {
return 367*y -
(7 * (y + (m+9)/12))/4 -
(3 * ((y + (m-9)/7)/100 + 1))/4 +
275*m/9 + d + 1721029;
}
void gregorian(int j, int *year, int *month, int *day) {
int a = j + 68569;
int b = 4*a / 146097;
@ekapujiw2002
ekapujiw2002 / guide.md
Created March 15, 2017 07:04 — forked from mikkeloscar/guide.md
Setup armv7h chroot under x86_64 host (Archlinux/Archlinuxarm biased)

Setup armv7h chroot under x86_64 host (Archlinux/Archlinuxarm biased)

Simple way to setup an arm chroot for building packages for your arm devices. This is an alternative to cross-compiling where you are limited to only linking against the libs in your toolchain.

Setup chroot-fs

You can store the chroot wherever you like. I choose to store it in a disk-image which I mount to my filesystem.

@ekapujiw2002
ekapujiw2002 / raspberry-pi-chroot-armv7-qemu.md
Created March 14, 2017 09:03 — forked from jkullick/raspberry-pi-chroot-armv7-qemu.md
Chroot into Raspberry Pi ARMv7 Image with Qemu
# install dependecies
apt-get install qemu qemu-user-static binfmt-support

# download raspbian image
wget https://downloads.raspberrypi.org/raspbian_latest

# extract raspbian image
unzip raspbian_latest
@ekapujiw2002
ekapujiw2002 / temp-server.py
Created March 10, 2017 03:09 — forked from joewashear007/temp-server.py
A Simple Web Socket Demo that displays current temperature from a Raspberry pi's GPIO pins using a temperature sensor. Needs: Rashberry Pi, temperature probe, python 2.7, Tornado Webserver 1) Read This: http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/temperature/ 2) Install tornado Webserver 3) Change the ws address in html file to the lo…
import time
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
from tornado.ioloop import PeriodicCallback
import tornado.web
class WSHandler(tornado.websocket.WebSocketHandler):
def open(self):
self.callback = PeriodicCallback(self.send_temp, 120)
@ekapujiw2002
ekapujiw2002 / crypto-pi-root.md
Created January 21, 2017 03:31 — forked from pezz/crypto-pi-root.md
Archlinux ARM encrypted root

Intro

Just some FYI, to get started:

  • I'm using a 16 GB Sandisk SD card.
  • I have a model B Pi, 512 MB RAM (not really relevant, thought I'd mention it).
  • Monitor and keyboard connected to the Pi itself, for now.
  • Network working, internet access.