Skip to content

Instantly share code, notes, and snippets.

View nut-nsys-hid-descriptor-parse.out
# parsed report from: https://gist.github.com/lkraider/729223f16025c1ff6223536896465e36
# using online tool: http://eleccelerator.com/usbdescreqparser/
0x05, 0x86, // Usage Page (Power Pages)
0x09, 0x04, // Usage (0x04)
0xA1, 0x01, // Collection (Application)
0x05, 0x84, // Usage Page (Power Pages)
0x09, 0x1E, // Usage (0x1E)
0xA1, 0x00, // Collection (Physical)
0x85, 0x01, // Report ID (1)
0x09, 0x1F, // Usage (0x1F)
@lkraider
lkraider / spam_decode.py
Created Jun 14, 2020
X-OVH-SPAMCAUSE decoder
View spam_decode.py
def decode(msg):
text = []
for i in range(0, len(msg), 2):
text.append(unrot(msg[i: i + 2]))
return str.join('', text)
def unrot(pair, key=ord('x')):
offset = 0
for c in 'cdefgh':
@lkraider
lkraider / nut-nsys-qx.log
Created Jan 8, 2020
nut NSYS E series - nutdrv_qx driver log
View nut-nsys-qx.log
~# /lib/nut/nutdrv_qx -a nsys1 -DDDDD -x vendorid=0001
Network UPS Tools - Generic Q* USB/Serial driver 0.28 (2.7.4)
USB communication driver 0.33
0.000000 send_to_all: SETINFO driver.parameter.vendorid "0001"
0.000033 debug level is '5'
0.000975 upsdrv_initups...
0.014797 Checking device (1D6B/0003) (002/001)
0.030369 - VendorID: 1d6b
0.030398 - ProductID: 0003
0.030408 - Manufacturer: unknown
@lkraider
lkraider / nut-nsys-blazer.log
Last active Jan 8, 2020
nut NSYS E series - blazer driver log
View nut-nsys-blazer.log
~# /lib/nut/blazer_usb -a nsys1 -DDDDD -x vendorid=0001
Network UPS Tools - Megatec/Q1 protocol USB driver 0.12 (2.7.4)
0.000000 send_to_all: SETINFO driver.parameter.vendorid "0001"
0.000038 debug level is '5'
0.021080 Checking device (1D6B/0003) (002/001)
0.036745 - VendorID: 1d6b
0.036778 - ProductID: 0003
0.036819 - Manufacturer: unknown
0.036842 - Product: unknown
0.036856 - Serial Number: unknown
@lkraider
lkraider / nut-nsys-hid-explore.log
Last active Jan 8, 2020
nut NSYS E series HID explore
View nut-nsys-hid-explore.log
~# /lib/nut/usbhid-ups -a nsys1 -DDDDD -x vendorid=0001 -x explore
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
0.000000 send_to_all: SETINFO driver.parameter.vendorid "0001"
0.000042 send_to_all: SETINFO driver.flag.explore "enabled"
0.000061 debug level is '5'
0.001022 upsdrv_initups...
0.017350 Checking device (1D6B/0003) (002/001)
0.037392 - VendorID: 1d6b
0.037425 - ProductID: 0003
View keybase.md

Keybase proof

I hereby claim:

  • I am lkraider on github.
  • I am lkraider (https://keybase.io/lkraider) on keybase.
  • I have a public key ASCtuhrH3CmFPAr8qYr8m8Q0gFEV8h9kXkKNBplfdp_LrAo

To claim this, I am signing this object:

View pbm_to_png.py
from PIL import Image
from io import BytesIO
import itertools
def as_pbm(w, h, data): # -> bytes
ret = bytes()
ret += b'P4\n'
ret += (str(w) + ' ' + str(h) + '\n').encode('ascii')
View How to link Sublime Text Build system to Python 3.md
View 1478-square-matrix-ii.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# https://www.urionlinejudge.com.br/judge/pt/problems/view/1478
from sys import stdout
w = stdout.write
m = ''.join('%03s ' % l for l in range(100, 0, -1) + range(2, 101))
n = input('')
while n > 0:
nn = n * 4
for ss in xrange(396, 396 - nn, -4):
@lkraider
lkraider / iam-terraform-create-policy.tf
Created Jul 7, 2017 — forked from arsdehnel/iam-terraform-create-policy.tf
AWS IAM policies for running Terraform from an EC2 instance.
View iam-terraform-create-policy.tf
resource "aws_iam_policy" "terraform_create_policy" {
name = "terraform_create_policy"
path = "/"
policy = "${data.aws_iam_policy_document.terraform_create_policy.json}"
}
data "aws_iam_policy_document" "terraform_create_policy" {
statement {
sid = "1"
actions = [