Skip to content

Instantly share code, notes, and snippets.

Software to install on clean ubuntu machine.
Compulsary:
sudo apt install -y mc geany redshift gtk-redshift cherrytree transmission terminator nmap gufw ubuntu-restricted-extras libavcodec-extra libdvd-pkg synaptic gdebi ntp scrot filezilla exfat-fuse exfat-utils pv sqlite lame html2text xdotool synaptic bless ffmpeg rtmpdump nano lynx cups-pdf meld duplicity python-gi geany-plugin-lineoperations geany-plugins supervisor mosquitto-clients openjdk-8-jre-headless openssh-server x11vnc vlc sysbench psensor glmark2 htop espeak git openjdk-8-jdk trimage devilspie2 python3-venv openvpn keepassx pinta tree gnome-tweaks gnome-tweak-tool virtualenv
sudo snap install notepad-plus-plus pdftk
Optional:
sudo apt install -y mumble r-base docker-compose wine-stable swftools aircrack-ng qemu-kvm krita gimp inkscape git-flow dbeaver-ce winetricks
@salman2learn
salman2learn / secure-azure-storage-accts.sh
Last active May 2, 2023 18:54
Bash script to secure azure storage accounts including existing containers (secure by default, remove anonymous access, restrict to cidrs/ip). Runs from Azure CLI or cloudshell.
set -ex # fail on first exception
#az login
#az account show
subs="My-Subs-Name"
az account set --subscription "$subs"
rg=$1
# Or use a fixed value of rg
rg=my-rg-name
@salman2learn
salman2learn / reshapeData.py
Last active April 19, 2021 13:53
Reshape data to make consistent column count. Line by line operation without high memory usage.
def reshape(srcFilePath, destFilePath, delim, colCount, filler=''):
with open(srcFilePath, 'r') as src, open(destFilePath, 'w') as dest:
for line in src:
arr = line.split(delim)
if len(arr) < colCount:
line = line.strip() + delim*(colCount-len(arr))
if len(arr) > colCount:
line = delim.join(arr[:colCount])
dest.write(f'{line}\n')
@salman2learn
salman2learn / file-split-by-line.py
Last active June 1, 2021 20:00
Split a large file into smaller files based on some delimiter text line
# the text files were later used to convert into images via pango-view and later via ffmpeg to vid
text = []
filenumber = 1
with open('51D.log', 'r') as f:
for line in f:
if line.startswith("-----"):
if len(text) > 0:
with open('text' + str(filenumber).zfill(4), 'w') as out:
out.writelines(text)
filenumber = filenumber+1
@salman2learn
salman2learn / vehicle-counter.py
Last active August 26, 2021 22:40
Counts vehicles in an image.
# pip3 install opencv-python==4.2.0.32
# wget https://pjreddie.com/media/files/yolov3.weights
# wget https://raw.githubusercontent.com/guptavasu1213/Yolo-Vehicle-Counter/master/yolo-coco/coco.names
# wget https://raw.githubusercontent.com/guptavasu1213/Yolo-Vehicle-Counter/master/yolo-coco/yolov3.cfg
# Finally, put this code in the same folder as above 3 files.
# python vehicle-counter.py
# References:
# Original source: https://github.com/guptavasu1213/Yolo-Vehicle-Counter
# Coco dataset: https://cocodataset.org/#home