Skip to content

Instantly share code, notes, and snippets.

View protoEvangelion's full-sized avatar
😋
joyful

R.G. protoEvangelion

😋
joyful
View GitHub Profile
@protoEvangelion
protoEvangelion / traceroute-geo.sh
Created March 16, 2023 21:56
Traceroute geolite2
traceroute npmjs.com | awk '{print $3}' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | while read p; do u=$(mmdblookup --file ./GeoLite2-City.mmdb --ip "$p" country names en | awk -F'"' '{print $2}'); echo "$p, $u"; done
blueprint:
name: Z2M IKEA Open/Close Remote
description: |
'Control your roller blind with an IKEA 2 button remote (the square ones).
this is the remote that's been delivered by the "Fytur" and " Kadrilj"
roller blinds.'
domain: automation
input:
remote:
name: Remote
@protoEvangelion
protoEvangelion / maze-2d.js
Created October 15, 2022 19:05
Node JS Maze Pathfinder Algo + Running Against TCP Dungeon Program (for a CTF)). Is not a shortest path algo. Just finds the end of the maze.
const { SocketClientTCP } = require("netlinkwrapper");
let maze;
let solved;
let lastTravelMsg;
const size = 30;
const endRow = size - 1;
const endCol = size - 1;
const port = 1234;
const client = new SocketClientTCP(port, "159.223.124.69");
@protoEvangelion
protoEvangelion / brute.js
Created June 17, 2022 00:01
brute force ldap injection with wildcard
/**
* As written this will brute force passwords to handle the case where LDAP injection allows the wildcard character:
* a*
* ab*
* abc*
*
* If the password works with the * we try that pass without the * to see if it works.
* If it does, we cracked the password.
* If not, we continue on adding another char thereby increasing the length of the password by 1.
*
@protoEvangelion
protoEvangelion / speedy-linux-box.sh
Last active June 7, 2022 00:02
speedy-linux-box
sudo apt update
sudo apt install fish copyq -y
echo "fish" >> ~/.bashrc
source ~/.bashrc
export type ExpandRecursively<T> = T extends (...args: infer A) => infer R
? (...args: ExpandRecursively<A>) => ExpandRecursively<R>
: T extends object
? T extends infer O
? { [K in keyof O]: ExpandRecursively<O[K]> }
: never
: Texport type ExpandRecursively<T> = T extends (...args: infer A) => infer R
? (...args: ExpandRecursively<A>) => ExpandRecursively<R>
: T extends object
? T extends infer O
@protoEvangelion
protoEvangelion / typescript-camel-case-object-keys-to-snake-case
Created May 16, 2022 23:03
Converts camelCase key in interface to snake_case key
// Adapted from: https://stackoverflow.com/a/65642944/6502003
type CamelToSnake<T extends string, P extends string = ''> = string extends T
? string
: T extends `${infer K}${infer R}`
? CamelToSnake<R, `${P}${K extends Lowercase<K> ? '' : '_'}${Lowercase<K>}`>
: P
/**
* Converts camelCase key in interface to snake_case key
* Example:
@protoEvangelion
protoEvangelion / gist:3751e5a3085fd7fbdc675e35742be2d1
Created December 1, 2021 19:14
webpack dev server onCompile hook
// unique port to this dev server
const port = 3000
const webpackConfig = {
entry: '...',
output: '...',
devServer: {
host: '0.0.0.0',
public: `localhost:${port}`,
disableHostCheck: true,
@protoEvangelion
protoEvangelion / Immer vs Immutable.js
Last active September 23, 2019 05:14
I wanted to do a side by side of Immer vs Immutable JS
// Immutable
import { fromJS } from 'immutable'
const args = fromJS(nopt(Command.DETAILS.options, Command.DETAILS.shorthands, process.argv, 2))
const secondArg = args.getIn(['argv', 'remain']).get(1)
const remote = args.get('remote') || config.default_remote
const remoteUrl = git.getRemoteUrl(remote)
const options = args.merge({
Hello World!