Skip to content

Instantly share code, notes, and snippets.

NOTE: this is a work-in-progress draft, please don't implement anything based on this yet. It's also missing a name. Suggestions very much appreciated.

Introduction to UHF RFID

UHF RFID tags (also known as "Gen 2" or "RAIN") are the lesser-known third type of RFID. Operating in the unlicensed 868MHz (EU)/900MHz (US) bands, they have a read range of up to 10m with a relatively low-cost, passive tag.

These tags are used by large retailers, including Decathlon and Uniqlo, for inventory control, barcodeless checkout, and theft prevention. (If you buy anything from Decathlon, make sure you cut the sewn-in tag out or your products will be uniquely trackable.)

UHF RFID tags include a unique identifier which usually either follows the GS1 Electronic Product Code standard or ISO/IEC 15961-1. Unfortunately, for both of these, you have to pay a hefty annual fee to get a prefix. To GS1's credit, all their specifications are freely available.

import proj4 from 'proj4'
proj4.defs([
[
'CCCAMP2019',
'+proj=tmerc +ellps=GRS80 +lat_0=0 +lon_0=15 +k=0.9996 +x_0=114350 +y_0=-5877600 +units=m +no_defs',
],
])
type CoordsLike = [number, number] | maplibregl.LngLat
@russss
russss / deskew.py
Created September 10, 2018 12:05
Automatic scanned image rotation/deskew with OpenCV
import cv2
import numpy as np
def deskew(im, max_skew=10):
height, width = im.shape
# Create a grayscale image and denoise it
im_gs = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
im_gs = cv2.fastNlMeansDenoising(im_gs, h=3)
# coding=utf-8
from __future__ import division, absolute_import, print_function, unicode_literals
import csv
import boto3
from zipfile import ZipFile
import io
import tempfile
from decimal import Decimal
import datetime
from collections import defaultdict
@russss
russss / ukpolitics-code-of-conduct.md
Last active May 5, 2016 22:16
##ukpolitics Code of Conduct
  • Sexist, homophobic, racist, transphobic, ableist, sexist or otherwise offensive remarks are not allowed. (Swearing is allowed, but never targeting another user, and never in a hateful or sexually explicit manner.)
  • Remarks that make any of the ops go “Hm, that’s inappropriate”, whether on the above list or not: also not allowed.
  • You get a warning.
  • If the warning is not taken seriously, you might get a second sterner warning in PM, if you’re lucky, and the op is feeling generous, and this is the first time. But don’t count on that.
  • If the warning is unheeded, you get kicked.
  • If you come back and continue to make trouble, you get banned.
  • If you contact the offended party, and are truly apologetic, and it was the first offense, and the op who banned you feels it’s appropriate, then you may get un-banned.
  • If an op bans you, I’m definitely not going to unban you unless they agree it’s a good idea.
  • If an op bans someone, and you think it was unjustified, take it up with that op, or with a differe
@russss
russss / commands.cfg
Created May 17, 2015 09:22
Icinga plugin for IRCCat
define command {
command_name notify-host-by-irccat
command_line /usr/local/share/nagios-plugins/icinga-irccat.py $HOSTNAME$ $HOSTSTATE$ | /bin/nc -q0 irccat-host 12345
}
define command {
command_name notify-service-by-irccat
command_line /usr/local/share/nagios-plugins/icinga-irccat.py -s "$SERVICEDESC$" -o "$SERVICEOUTPUT$" $HOSTNAME$ $SERVICESTATE$ | /bin/nc -q0 irccat-host 12345
}
@russss
russss / gist:8aa174669b2b8345eaed
Last active August 29, 2015 14:09
keybase.md
### Keybase proof
I hereby claim:
* I am russss on github.
* I am russss (https://keybase.io/russss) on keybase.
* I have a public key whose fingerprint is BE75 264B 665E D97E A5DB EFD5 F52F C56D D906 FEB1
To claim this, I am signing this object:
set nonumber
syntax on
filetype plugin indent on
augroup myfiletypes
autocmd!
autocmd BufNewFile,BufRead *.jinja set filetype=jinja
autocmd BufNewFile,BufRead *.sql set filetype=psql
autocmd BufNewFile,BufRead *.migration set filetype=psql
autocmd BufNewFile,BufRead *.vcl set filetype=vcl
# Listen to a CurrentCost monitor on the serial port and forward data to Graphite
import serial
import socket
import time
from lxml import etree
ser = serial.Serial('/dev/ttyUSB0', 57600)
def send_metric(value):
sock = socket.socket()
@russss
russss / graphite-jenkins.py
Created June 7, 2012 10:46
Quick script to send Jenkins successful build durations to Graphite
#!/usr/bin/env python
""" Sends Jenkins build duration statistics to Graphite. """
import requests
import json
from graphite import Graphite # This is our closed-source library but you get the idea.
JENKINS_URL='http://jenkins'
GRAPHITE_HOST='10.x.x.x'
GRAPHITE_PREFIX='jenkins.main.build_time.'