Skip to content

Instantly share code, notes, and snippets.

@leveled
leveled / flush_dns_macos.sh
Created November 14, 2023 14:50
Flush DNS on MacOs
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
@leveled
leveled / powershell_cheatsheet.ps1
Last active May 2, 2023 15:48
Powershell Cheatsheet
#Create Powershell Profile
New-Item -Path $profile -ItemType File -Force
#Installing Vim movement
Get-Module PSReadLine -ListAvailable
Install-Module PSReadLine -Scope CurrentUser
Set-PSReadLineOption -EditMode Vi
notepad $profile
#Referencing environment variables
@leveled
leveled / return_ipv6_interface_address.sh
Created December 6, 2022 16:04
Filter out ipv6 addresses on an interface and return
ip -f inet6 addr show eth0 | sed -En -e 's/.*inet6 ([0-9a-fA-F:]+).*/\1/p'
@leveled
leveled / print_timestamp_cli.sh
Created September 15, 2022 20:21
Print the timestamp along with line for CLI output
#ts is in moreutils
command | ts '[%Y-%m-%d %H:%M:%S]'
@leveled
leveled / extended_slicing_lists_python.py
Created July 6, 2022 16:46
Iterating through a list 2 characters at a time/extended slicing of lists in python
for (op, code) in zip(s[0::2], s[1::2]):
print op, code
@leveled
leveled / passthrough_ctrlc_to_qemu_guest.sh
Created May 17, 2022 22:55
Passthrough Ctrl-C to Qemu Guest
#change interrupt key to ctrl-]
stty intr ^]
#now ctrl-c will be passed through to guest
@leveled
leveled / pull_debug_symbols.sh
Created May 17, 2022 22:13
Pull debug symbols into sym file on Linux
objcopy --only-keep-debug vmlinux kernel.sym
@leveled
leveled / reading_private_var.js
Created March 26, 2022 00:43
Reading a private variable from a contract (using ethers.js)
eth.getStorageAt(address, location)
@leveled
leveled / pm_cheatsheet
Created March 10, 2022 15:54
pm (package manager on android) cheatsheet
pm grant <perm> package //grant permission to package
@leveled
leveled / example_ndk_build.sh
Created March 10, 2022 15:54
Example NDK build
/home/aajit/projects/android-ndk-r23b/ndk-build -B NDK_PROJECT_PATH=. NDK_APPLICATION_MK=./Application.mk NDK_APP_DST_DIR=./build/ NDK_APP_OUT=./build/ APP_BUILD_SCRIPT=./Android.mk