Skip to content

Instantly share code, notes, and snippets.

View apolloclark's full-sized avatar
💭
automating the world

Apollo Clark apolloclark

💭
automating the world
View GitHub Profile

Bash One-Liners

A collection of various moderate to very complex one-liners I use occasionally. I have a collection of various Bash commands here:

count number of lines, all files in a folder, sort

find . -type f -print0 | wc -l --files0-from=- | sort -n
replace line 5 in a text file

Bash Scripting Cheatsheet

This a collection of simple to advanced scripting techniques for Bash.

#!/bin/bash
# update apt-get
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get update
# remove previously installed Docker
sudo apt-get purge lxc-docker*
sudo apt-get purge docker.io*
#!/bin/bash
# rotate ALL users, including yourself
# allUsers=$(aws iam list-users --output text | cut -f 6);
# read from a file, one username per line
# preferably set their username to their email address
allUsers=$(cat ./user-names.txt);
for userName in $allUsers; do
print all 255 ASCII characters in hex
for x in range(255): print hex(x),
diff --git a/ext/json/ext/fbuffer/fbuffer.h b/ext/json/ext/fbuffer/fbuffer.h
index af74187..9524fb1 100644
--- a/ext/json/ext/fbuffer/fbuffer.h
+++ b/ext/json/ext/fbuffer/fbuffer.h
@@ -172,7 +172,7 @@ static FBuffer *fbuffer_dup(FBuffer *fb)
static VALUE fbuffer_to_s(FBuffer *fb)
{
- VALUE result = rb_str_new(FBUFFER_PAIR(fb));
+ VALUE result = rb_str_new(FBUFFER_PTR(fb), FBUFFER_LEN(fb));
@apolloclark
apolloclark / Buffer Overflow Tutorial in Kali.md
Last active January 21, 2026 02:33
Buffer overflow demonstration in Kali Linux, based on the Computerphile video
@apolloclark
apolloclark / enumerate_url.md
Last active April 1, 2017 19:51
Enumerate (id, username, etc.) against a URL, using parallel to parallelize it

Make sure you are running an HTTP proxy on 127.0.0.1:8080 I suggest Burpsuite, Free Edition: https://portswigger.net/burp/download.html

I wrote this in Bash, not because it was easy, but because it was fast. This script lets you max out your CPU and network resources far better than Burpsuite, or a stand-alone python script, by taking advantage of the parallel program, and the many decades of C code optimization that's gone into Bash and GnuUtils.

[enumerate_url.sh]

#!/bin/bash

curlJsonEnum(){
@apolloclark
apolloclark / nmap_scanner.md
Last active January 4, 2019 00:59
NMap Top 1000 ports scan script

[nmap_scanner.sh]

#!/bin/bash

# create the output directory
mkdir ./nmap_scan

# loop over each ending ip octet
@apolloclark
apolloclark / mongodb cheatsheet.md
Last active July 20, 2022 05:30
mongodb cheatsheet