Skip to content

Instantly share code, notes, and snippets.

View LevitatingBusinessMan's full-sized avatar
🕴️
Levitating

Rein Fernhout LevitatingBusinessMan

🕴️
Levitating
View GitHub Profile
@LevitatingBusinessMan
LevitatingBusinessMan / calc_costs.js
Created March 26, 2020 16:48
Calculate money spent on a g2a orders page
Array.from(document.getElementsByClassName("jsx-4244195770")).forEach(node => {
if (node.innerHTML.includes("Canceled"))
node.remove()
})
Array.from(document.querySelectorAll(".priceWithLabel .large span strong.jsx-170025548")).map(node => parseFloat(node.innerHTML)).reduce((acc, price) => acc + price)
@LevitatingBusinessMan
LevitatingBusinessMan / route.service
Created August 9, 2020 11:34
Port router service
[Unit]
Description=Route ports
[Service]
ExecStart=/root/route.sh
[Install]
WantedBy=multi-user.target
@LevitatingBusinessMan
LevitatingBusinessMan / steam_report.txt
Created September 22, 2020 11:00
Steam hardware report
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 3 1200 Quad-Core Processor
CPU Family: 0x17
@LevitatingBusinessMan
LevitatingBusinessMan / membrute.rb
Created October 12, 2020 15:10
Bruteforce memcached keys
#Reference: https://github.com/memcached/memcached/blob/master/doc/protocol.txt
puts "\e[31mmembrute by Levitating\e[0m"
require "optparse"
require "socket"
args = {
:port=>11211
@LevitatingBusinessMan
LevitatingBusinessMan / hashmap.c
Last active February 18, 2021 17:42
Hashmap implementation in C with linear probing
#include <stdlib.h>
#include <string.h>
//This is a hashmap using an open addressing method
//http://craftinginterpreters.com/hash-tables.html#open-addressing
#include "hashmap.h"
//FNV-1a
static unsigned int hash_string(const char* key, int length) {
unsigned int hash = 2166136261u;
@LevitatingBusinessMan
LevitatingBusinessMan / sync_led.sh
Created January 19, 2021 23:10
Sync my scrollock with ceiling lights.
OUTPUT=$(node projects/yeelight-cli/index.js get_prop power)
LED="/sys/class/leds/input17::scrolllock/brightness"
case $OUTPUT in
"{ id: 0, result: [ 'on' ] }")
POWER=1;;
"{ id: 0, result: [ 'off' ] }")
POWER=0;;
*)
@LevitatingBusinessMan
LevitatingBusinessMan / coreutils_hook.sh
Last active April 27, 2021 22:41
Hook I am using on uutils/coreutils. Just place as .git/hooks/pre-commit and make it executable.
#!/bin/sh
CARGO_VER=1.40.0
STAGED=$(git diff --name-only --cached | grep '.*\.rs')
PREV_DEFAULT_VERSION=$(rustup show | grep default | head -n1 | sed 's/(default)//')
rustup default $CARGO_VER-x86_64-unknown-linux-gnu
@LevitatingBusinessMan
LevitatingBusinessMan / hide.c
Last active October 11, 2023 12:50
LD_PRELOAD rootkit for hiding or redirecting files
#define _GNU_SOURCE
#include <dlfcn.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
int new_fds[50][2] = {{0,0}};
@LevitatingBusinessMan
LevitatingBusinessMan / nlruby.h
Created September 16, 2021 12:52
Piglatin in dutch ruby, compile via a C preprocessor: "gcc -xc -E piglatin.rb 2> /dev/null"
#define is =
#define plus +
#define min -
#define juist true
#define onjuist false
#define einde end
#define krijgd gets
#define plaatsd puts
#define hak chomp
#define als if
diff --git a/init.c b/init.c
index 8b32a1a..fd17692 100644
--- a/init.c
+++ b/init.c
@@ -935,7 +935,7 @@ static int cutorch_isManagedPtr(lua_State *L)
lua_pushboolean(L, 0);
} else {
THCudaCheck(res);
- lua_pushboolean(L, attributes.isManaged);
+ lua_pushboolean(L, attributes.type == cudaMemoryTypeManaged);