Skip to content

Instantly share code, notes, and snippets.

@yusufk
yusufk / gist:ae2e9d0cb5b3b02224135541036330be
Last active April 1, 2024 09:34
Spoofed MAC on Macbook M1
  1. disconnect from the wifi (don't turn the adapter off)
  2. generate a mac address like mac_address="$(networksetup -listallhardwareports | awk -v RS= '/en0/{print $NF}' | head -c 8):$(openssl rand -hex 3 | sed 's/\(..\)/\1:/g; s/.$//')"
  3. sudo ifconfig en0 ether "$mac_address"
  4. networksetup -detectnewhardware
  5. Check the spoofed mac with ifconfig en0 | grep ether | awk '{print $2}' and networksetup -listallhardwareports | awk -v RS= '/en0/{print $NF}'

Courtesy feross/SpoofMAC#87 (comment)

@yusufk
yusufk / del_small_s3_files.sh
Created April 15, 2023 19:49
Delete all S3 objects with a size in KiB (small files)
for file in `aws s3 ls s3://<bucket>/<folder> --region eu-west-2 --human-readable --recursive | grep KiB | tr -s ' ' | cut -d ' ' -f5`; do `aws s3 rm --recursive s3://<bucket>/$file --region eu-west-2`; done
@yusufk
yusufk / praytimes.py
Created May 14, 2019 13:33 — forked from skeeph/praytimes.py
Python library for computing islamic prayers schedule
#!/usr/bin/env python
# compatible with python 2.x and 3.x
import math
import re
'''
--------------------- Copyright Block ----------------------
praytimes.py: Prayer Times Calculator (ver 2.3)
@yusufk
yusufk / find_file_by_time_in_filename.sh
Last active May 14, 2019 10:45
Find a file by the timestamp embedded in the filename
#Filename in the format myfiles-yymmdd-hhmmss
today=`date +%Y%m%d`
for filename in /usr/local/recordings/3-uploaded/myfiles-$today*.mp3; do
the_date=`echo $filename|awk -F '[-.]' '{print $4}'`
day=`echo $filename|awk -F '[-.]' '{print $4}'`
t=`echo $filename|awk -F '[-.]' '{print $5}'`
if [[ $t -gt "204000" ]]; then
if [[ $t -lt "205500" ]]; then
thefile=$filename
fi
@yusufk
yusufk / ota_push_proxy.xml
Last active December 7, 2018 10:03
wbxml config for proxy
<wap-provisioningdoc>
<characteristic type="CM_ProxyEntries">
<characteristic type="HTTP-{A1182988-0D73-439e-87AD-2A5B369F808B}">
<parm name="SrcId" value="{A1182988-0D73-439e-87AD-2A5B369F808B}" />
<parm name="DestId" value="{436EF144-B4FB-4863-A041-8F905A62C572}" />
<parm name="Proxy" value="proxyservername:80" />
</characteristic>
</characteristic>
</wap-provisioningdoc>
@yusufk
yusufk / cntlm_hash.sh
Created January 11, 2017 08:52
Generate cntlm hash
sudo cntlm -c /etc/cntlm.conf -I -M http://google.co.za
### Keybase proof
I hereby claim:
* I am yusufk on github.
* I am yusufk (https://keybase.io/yusufk) on keybase.
* I have a public key whose fingerprint is BB4A ADF7 16F0 CBD8 FECB 6196 7DD1 9AF2 6977 C82A
To claim this, I am signing this object:
@yusufk
yusufk / txredns.py
Created April 24, 2012 16:06 — forked from fcoury/txredns.py
Python/Twisted/Redis backed DNS server.
# Python/Twisted/Redis backed DNS server - resolves from NAME to IP addrs
# fallback to google or any other DNS server to resolv domains not present on Redis
# to set a new domain on redis, just issue a SET domain.tld ip_addr
# run with twistd -ny txredns.tac
# gleicon 2011
from twisted.names import dns, server, client, cache
from twisted.application import service, internet
from twisted.internet import defer
from twisted.python import log
@yusufk
yusufk / redisdns.py
Created April 24, 2012 16:06 — forked from wheresalice/redisdns.py
Python DNS server with Redis backend
# A naive dns server with a Redis backend
# Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1)
# Tip: Use Redis's ttl functions to have temporary names
# Currently only does A records, feel free to fix that
#
# Licensed under the PSF License
# Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/
# Author: @Kaerast <alice@kaerast.info>
import socket