Skip to content

Instantly share code, notes, and snippets.

@half2me
half2me / antplus.lua
Last active February 15, 2024 12:13
Wireshark Plugin ANT+ Dissector
-- requires https://github.com/Snaipe/wssdl/releases/download/v0.2.0/wssdl.lua
local wssdl = require 'wssdl'
ant_msg = wssdl.packet {
sync:u8():hex(),
length:u8(),
class:u8():hex(),
payload:payload({ class, 'antplus.class' }, length * 8),
checksum:u8():hex()
}
@half2me
half2me / stepfunction.json
Created September 14, 2022 10:27
DynamoDB table iteration with a StepFunction
{
"StartAt": "Add empty LastEvaluatedKey",
"States": {
"Add empty LastEvaluatedKey": {
"Type": "Pass",
"Next": "Scan",
"Result": {
"LastEvaluatedKey": null
},
"ResultPath": "$"
@half2me
half2me / gst-rtsp.py
Created April 23, 2020 19:23
RTSP authentication with python and gst-rtsp-server
server = GstRtspServer.RTSPServer()
auth = GstRtspServer.RTSPAuth()
token = GstRtspServer.RTSPToken()
token.set_string('media.factory.role', "user")
basic = GstRtspServer.RTSPAuth.make_basic("user", "password")
auth.add_basic(basic, token)
server.set_auth(auth)
factory = RtspFactory()
permissions = GstRtspServer.RTSPPermissions()
@half2me
half2me / ugly.php.txt
Created February 25, 2020 14:41
PHP Is Ugly
<?php
// what is my name? What do I output?
define('JAKE', "Jake");
;;;;;echo"Jake".JAKE. <<<JAKE
Jake
?>
JAKE;
JAKE;
JAKE;
@half2me
half2me / cloudberry.js
Last active November 28, 2019 15:46
Remove cloudberries from Nespresso
// ==UserScript==
// @name No Cloudberry
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove cloudberry from Nespresso!
// @author h@lfto.me
// @match *://www.nespresso.com/*/order/capsules/original
// @match *://www.nespresso.com/*/home
// @grant none
// ==/UserScript==
@half2me
half2me / .zshrc
Created September 12, 2019 09:56
run a command on kubernetes pod by deployment name
k8exec() {
local pod=$1
shift
kubectl exec -it $(kubectl get pods -o name | grep -m1 $pod | cut -d'/' -f 2) -- $@
}
@half2me
half2me / keybase.md
Created July 27, 2019 21:49
keybase.md

Keybase proof

I hereby claim:

  • I am half2me on github.
  • I am halftome (https://keybase.io/halftome) on keybase.
  • I have a public key ASBYjXnttEq63LZstTmJ3xkzigb4nML2hGIAYOUJOrmMqwo

To claim this, I am signing this object:

location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
expires max;
log_not_found off;
@half2me
half2me / rem.sh
Created July 25, 2018 11:17
Remove file from PR
git checkout pr-branch
git reset origin/master -- /path/to/file
git commit
git checkout -- . # or git reset --hard @
git push
@half2me
half2me / server.py
Last active March 8, 2021 06:33
GST RTSP Server
import logging
import gi
from gst.caps import CapsRegistry
from gst.pipe_loader import PipelineLoader
from gst.pipeline import Pipeline
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')