Skip to content

Instantly share code, notes, and snippets.

View skakri's full-sized avatar
🖱️
Click to enable Adobe Flash Player

Kristaps Karlsons skakri

🖱️
Click to enable Adobe Flash Player
View GitHub Profile
@skakri
skakri / APDUList.txt
Created June 28, 2021 14:44 — forked from jubbyy/APDUList.txt
APDU list
Cheef's Grand APDU List Smartcard Selected Information APDU list
Reference: http://web.archive.org/web/20090630004017/http://cheef.ru/docs/HowTo/APDU.info
and this : https://neapay.com/post/read-smart-card-chip-data-with-apdu-commands-iso-7816_76.html
response can be found here : https://www.eftlab.com/knowledge-base/complete-list-of-apdu-responses/
#------------+------------------------+------------------------+----------------------+--------------------------------+
|ClaIns P1 P2|Lc Send Data |Le Recv Data | Specification | Description |
+------------+------------------------+------------------------+----------------------+--------------------------------+
| 04 | ISO 7816-9 6.3 | DEACTIVATE FILE |
| A0 04 00 00 00 | 3GPP TS 11.11 | INVALIDATE |
@skakri
skakri / crlf.screenrc
Created June 27, 2019 12:02 — forked from cabo/crlf.screenrc
Make GNU screen convert return key (CR) into CR-LF
# put this in your ~/.screenrc to make
# ^A D (uppercase) switch on, and
# ^A U (uppercase) switch off, converting
# CR (return keys) input into CRLF
bind D bindkey "\015" stuff "\015\012"
bind U bindkey "\015" stuff "\015"
@skakri
skakri / crlf.screenrc
Created June 27, 2019 12:02 — forked from cabo/crlf.screenrc
Make GNU screen convert return key (CR) into CR-LF
# put this in your ~/.screenrc to make
# ^A D (uppercase) switch on, and
# ^A U (uppercase) switch off, converting
# CR (return keys) input into CRLF
bind D bindkey "\015" stuff "\015\012"
bind U bindkey "\015" stuff "\015"
@skakri
skakri / i2c_stm.c
Created January 15, 2019 20:25 — forked from qdk0901/i2c_stm.c
i2c slave with PMS150C
#define I2C_SLAVE_ADDRESS (0xA0 >> 1)
#define BUF_SIZE 16
enum {
IDLE,
START,
STOP,
ADDR,
OP,
READDATA,
#! /bin/bash
# Ascii to Small Latin
# Usage: thisscript <in.txt >out.txt
# or: thisscript <<<"some-text"
while IFS= read -d$'\0' -r -n1 c # read single bytes
do
printf -vd "%d" "'$c" # decimal ordinal
(( d >= 65 && d <=90 )) && (( d += 65248 )) # A-Z -> small latin
((d >= 97 && d <= 122 )) && (( d += 65248 )) # a-z -> small latin
(( d > 255 )) && printf \\U$(printf "%08X" "$d") # Unicode UTF-8
# WSG84
R = 6378137.0 # Equator radius in meters
f = 0.00335281066474748071 # 1/298.257223563, inverse flattening
def lla2flat(lla, llo, psio, href):
'''
lla -- array of geodetic coordinates
(latitude, longitude, and altitude),
in [degrees, degrees, meters].
function ret = lla2flat( lla, llo, psio, href )
% WSG84
R = 6378137.0; % Equator radius in meters
f = 0.00335281066474748071; % 1/298.257223563, inverse flattening
Lat_p = lla(1) * pi / 180.0; % from degrees to radians
Lon_p = lla(2) * pi / 180.0; % from degrees to radians
Alt_p = lla(3); % meters

Power Saving tips for the ESP8266

Software Tips

Use DeepSleep.

This is the #1 recommendation when designing a low power ESP8266 application. Note that this requires hardware changes, too. GPIO16 must be tied to the RST pin, and RST should be pulled HIGH externally. The ESP8266 will pull GPIO16 LOW to reset the chip once the deep sleep timer expires.

@skakri
skakri / spawn_once.lua
Created August 31, 2016 16:47 — forked from Flowkap/spawn_once.lua
This is a small gist for autostarting applications with Awesome Window Manager (http://awesome.naquadah.org/) without the need to use a third party plugin like shifty. It's maybe not nice but works!
-- {{{
--
-- Autostarting for Awesome <3.4!
-- Add this section to the end of your rc.lua
-- configuration file within ~/.config/awesome/rc.lua
--
-- If you're using Awesome 3.5 change:
-- add_signal -> connect_signal
-- remove_signal --> disconnect_signal
--
@skakri
skakri / pca9685.lua.lua
Created August 29, 2016 19:33 — forked from anonymous/pca9685.lua.lua
pca9685.lua
local modname = ...
local M = {}
_G[modname] = M
local id = nil
local addr = nil
-- some flags from mode register, low byte is MODE1 and high is MODE2
M.INVERT = 0x1000