Skip to content

Instantly share code, notes, and snippets.

View saud978's full-sized avatar
👋

Saud saud978

👋
View GitHub Profile
@saud978
saud978 / gpg.conf
Created September 8, 2021 06:20 — forked from o-can/gpg.conf
Setting up GPG signature on Mac OS X with Xcode
# Add these lines
batch
passphrase-file <Full path to the key.txt file (without tilda)>
@saud978
saud978 / CalculateAge.swift
Last active February 19, 2019 17:59 — forked from andatta/CalculateAge.swift
Swift code to calculate age in years, months and days from a person's dob
// Updated to swift 4.2
func calculateAge(dob : String) -> (Int, Int, Int){
let df = DateFormatter()
df.dateFormat = "yyyy-MM-dd"
let date = df.date(from: dob)
guard let val = date else {
return (0, 0, 0)
}
var years = 0
@saud978
saud978 / iptables_color.txt
Last active December 24, 2018 15:43 — forked from nega0/iptables_color.txt
colorize your `iptables` output
## based on the blogpost here: http://blog.sjas.de/posts/colored-iptables-output.html
iptables --line-numbers -vnL |\
sed -E 's/^Chain.*$/\x1b[4m&\x1b[0m/' |\
sed -E 's/^num.*/\x1b[33m&\x1b[0m/' |\
sed -E '/([^y] )((REJECT|DROP))/s//\1\x1b[31m\3\x1b[0m/' |\
sed -E '/([^y] )(ACCEPT)/s//\1\x1b[32m\2\x1b[0m/' |\
sed -E '/([ds]pt[s]?:)([[:digit:]]+(:[[:digit:]]+)?)/s//\1\x1b[33;1m\2\x1b[0m/' |\
sed -E '/([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}(\/([[:digit:]]){1,3}){0,1}/s//\x1b[36;1m&\x1b[0m/g' |\
sed -E '/([^n] )(LOGDROP)/s//\1\x1b[33;1m\2\x1b[0m/'|\