Skip to content

Instantly share code, notes, and snippets.

View sj26's full-sized avatar
🤹‍♂️

Samuel Cochran sj26

🤹‍♂️
View GitHub Profile
@mbikovitsky
mbikovitsky / killbutmakeitlooklikeanaccident.bat
Last active July 31, 2023 17:52 — forked from moyix/killbutmakeitlooklikeanaccident.sh
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
@"C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe" -sins -y "srv*nul" -c "r rip = ntdll!NtTerminateProcess; r rcx = -1; r rdx = 0; r rsp = (@rsp & 0xFFFFFFFFFFFFFFF0) - 8; eq @rsp (-1); qd" -p %1
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@samthor
samthor / notes.md
Last active September 23, 2021 03:59
Read/write Clipsal smart switches

This is notes for anyone who is interacting with (in Australia at least) Clipsal-branded smart switches that operate over BLE. (They also come with a ZigBee certification document, but it seems like it was never enabled.)

They have a couple of interesting UUIDs (these are here for y'all searching for them):

  • Control service, 720a9080-9c7d-11e5-a7e3-0002a5d5c51b

    • State characteristic (i.e., switch on/off), 720a9081-9c7d-11e5-a7e3-0002a5d5c51b
    • Level characteristic (i.e., brightness), 720a9082-9c7d-11e5-a7e3-0002a5d5c51b
  • Command service, 720a7080-9c7d-11e5-a7e3-0002a5d5c51b

  • Request characteristic, 720a7081-9c7d-11e5-a7e3-0002a5d5c51b

Origin: Ubuntu
Label: Ubuntu
Suite: hirsute
Version: 21.04
Codename: hirsute
Date: Thu, 04 Feb 2021 9:47:45 UTC
Architectures: amd64 arm64 armhf i386 ppc64el riscv64 s390x
Components: main restricted universe multiverse
Description: Ubuntu Hirsute 21.04
MD5Sum:
@phindmarsh
phindmarsh / example.py
Created November 3, 2020 09:40
Clipsal/PDL Iconic BLE Dimmer
dimmer = WiserDimmer("XX:XX:XX:XX:C3:E0")
# turn dimmer on at full brightness
dimmer.state_on()
dimmer.level_set(10000)
# set level to 50% (min 0, max 10000)
dimmer.level_set(5000)
print(dimmer.level)
print(dimmer.state) # ON
@lazaronixon
lazaronixon / dropzone_controller.js
Last active March 9, 2024 05:14
Dropzone.js + Stimulus + Active Storage
import { Controller } from "stimulus"
import { DirectUpload } from "@rails/activestorage"
import Dropzone from "dropzone"
import { getMetaValue, findElement, removeElement, insertAfter } from "helpers"
Dropzone.autoDiscover = false
export default class extends Controller {
static targets = [ "input" ]
@guilherme-teodoro
guilherme-teodoro / style.css
Last active December 16, 2020 15:43
[Stylus] Basecamp 3 - Dark mode
body {
background: #191919;
color: white;
}
h1 {
color: white;
}
.nav__bar {
@plasticine
plasticine / help.makefile
Last active August 28, 2019 11:30
Automatically extract help from your Makefiles using some fully sick awk hacks
# You're looking at it! :)
help:
@makehelp < $(MAKEFILE_LIST)
.PHONY: help
@lox
lox / InstallBuildkiteAgent.ps1
Last active February 23, 2018 09:40
Install buildkite-agent in Windows as a Service
Param(
$agentVersion = "3.0-beta.39",
$agentToken = "xxx",
$agentTags = "windows",
$installDir = "C:\buildkite"
)
## Verify we are elevated
## https://superuser.com/questions/749243/detect-if-powershell-is-running-as-administrator
@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"