Skip to content

Instantly share code, notes, and snippets.

@rightson
rightson / basesf_utility.py
Last active March 7, 2024 03:24
Base 64 Converter
import argparse
import base64
import zipfile
import os
def convert_exe_to_base64_and_zip(input_file, output_path):
"""Converts an EXE file to Base64, zips the encoded content, and renames the archive to .b64.zip."""
with open(input_file, 'rb') as file:
binary_data = file.read()
base64_encoded_data = base64.b64encode(binary_data).decode('utf-8')
@rightson
rightson / scan-ipv4.sh
Last active February 17, 2024 08:45
Scanning IPv4 addresses in use
if [ "$#" -eq 0 ]; then
targets="70 71 79 91 92 93 94"
else
targets=$*
fi
echo -e "Targets to scan:\n $targets"
in_use=()
for suffix in $targets; do
@rightson
rightson / example-query.js
Last active January 9, 2024 12:49
example query
db.collection.aggregate([
{
$addFields: {
nonEmptyValues: {
$filter: {
input: { $objectToArray: "$Status" },
as: "status",
cond: { $ne: ["$$status.v.value", ""] }
}
}
@rightson
rightson / docker-load.py
Last active June 17, 2023 05:57
docker pull/load from CLI
import tarfile
import subprocess
import json
import sys
image = sys.argv[1]
# Create a dictionary for the image manifest
manifest_dict = {
# Minimize current window
xdotool windowminimize $(xdotool getactivewindow)
# Make current window always on top
wmctrl -r :ACTIVE: -b toggle,above
# Undo aways-on-top window
wmctrl -r :ACTIVE: -b remove,above
@rightson
rightson / OpenWithSublimeText3-Full.bat
Created May 23, 2021 15:43
Open With Sublime Text 3 Full Version
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@rightson
rightson / grep_function_names.sh
Created January 9, 2021 05:45
A function to grep bash function name declared as "function $name () {" pattern
grep_function_names () {
if [ -e "$1" ]; then
grep -E '^function' $1| awk '{print $2}' | sed -r 's/\(|\)|\{|\}//g'
fi
}
@rightson
rightson / PulseClient_x86_64.sh
Created December 20, 2020 07:02
PulseClient_x86_64.sh for Ubuntu 20.04
#!/bin/bash
# Copyright (c) 2019-2020 by Pulse Secure, LLC. All rights reserved
HOMEDIR=$HOME
INSTALLDIR=/usr/local/pulse
PULSEDIR=$HOME/.pulse_secure/pulse
PULSECERTDIR=$PULSEDIR/certificates
SVCNAME=pulsesvc
UTILNAME=pulseutil
@rightson
rightson / ipset-blacklist
Created January 20, 2020 03:11
My Blacklist
Name: blacklist
Type: hash:net
Revision: 6
Header: family inet hashsize 2048 maxelem 65536
Size in memory: 132248
References: 0
Number of entries: 4769
Members:
1.203.115.64
1.213.195.154
@rightson
rightson / Makefile
Created July 31, 2019 01:58
LaTex build tips
PAPER := main
# remember to add \usepackage[dvipdfm]{graphicx} to your $(PAPER).tex
pdf:
latex $(PAPER).tex
dvipdfm $(PAPER).dvi
.PHONY: pdf