Skip to content

Instantly share code, notes, and snippets.

@half2me
half2me / stepfunction.json
Created Sep 14, 2022
DynamoDB table iteration with a StepFunction
View stepfunction.json
{
"StartAt": "Add empty LastEvaluatedKey",
"States": {
"Add empty LastEvaluatedKey": {
"Type": "Pass",
"Next": "Scan",
"Result": {
"LastEvaluatedKey": null
},
"ResultPath": "$"
@half2me
half2me / gst-rtsp.py
Created Apr 23, 2020
RTSP authentication with python and gst-rtsp-server
View gst-rtsp.py
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()
View ugly.php.txt
<?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 Nov 28, 2019
Remove cloudberries from Nespresso
View cloudberry.js
// ==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 Sep 12, 2019
run a command on kubernetes pod by deployment name
View .zshrc
k8exec() {
local pod=$1
shift
kubectl exec -it $(kubectl get pods -o name | grep -m1 $pod | cut -d'/' -f 2) -- $@
}
View 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:

View nginx-directive-wordpress
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 Jul 25, 2018
Remove file from PR
View rem.sh
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 Mar 8, 2021
GST RTSP Server
View server.py
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')
View BaseCardlet.java
package com.fidesmo.javacard.example;
import javacard.framework.*;
import javacard.security.*;
public abstract class BaseCardlet extends Applet implements ISO7816 {
KeyPair kp;
Signature sig;
BaseCardlet(byte[] buffer, short offset, byte length) {