Skip to content

Instantly share code, notes, and snippets.

View maxrodrigo's full-sized avatar
🪐
(loop(print "code hack automate"))

Max Rodrigo maxrodrigo

🪐
(loop(print "code hack automate"))
View GitHub Profile
@maxrodrigo
maxrodrigo / conky_objects_and_variables.md
Created March 31, 2020 16:59
Conky Objects and Variables

Conky OBJECTS/VARIABLES

Some objects may create threads, and sometimes these threads will not be destroyed until Conky terminates. There is no way to destroy or clean up threads while Conky is running. For example, if you use an MPD variable, the MPD thread will keep running until Conky dies. Some threaded objects will use one of the parameters as a key, so that you only have 1 relevant thread running (for example, the $curl, $rss and $weather objects launch one thread per URI).

acpiacadapter (adapter)
ACPI ac adapter state. On linux, the adapter option specifies the subfolder of /sys/class/power_supply con‐

@maxrodrigo
maxrodrigo / git-split-and-push.sh
Last active March 9, 2024 11:20
Split a repository into batches to avoid `pack exceeds maximum allowed size` on push
# Split a repository into batches to avoid `pack exceeds maximum allowed size` on git push
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=500
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
range=$REMOTE/$BRANCH..HEAD
@maxrodrigo
maxrodrigo / install-chrome-headless.sh
Last active March 6, 2024 11:22
Puppeteer/Chrome Headless on EC2 Amazon Linux AMI
#!/bin/env bash
# Install 3rd party repositories
sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/atk-2.22.0-3.el7.x86_64.rpm
sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-atk-2.22.0-2.el7.x86_64.rpm
sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-core-2.22.0-1.el7.x86_64.rpm
# Install dependencies
sudo yum install -y nodejs gcc-c++ make cups-libs dbus-glib libXrandr libXcursor libXinerama cairo cairo-gobject pango libXScrnSaver gtk3
@maxrodrigo
maxrodrigo / details.html
Created April 29, 2020 16:01
Details disclosure and summary elements hugo shortcode.
{{ .Scratch.Set "lastp" (sub (.Params | len) 1) }}
<details {{ if .Get 0 | eq "open"}} open {{ end }}>
<summary>
{{ .Get (.Scratch.Get "lastp") }}
</summary>
{{ .Inner | markdownify }}
</details>
@maxrodrigo
maxrodrigo / icmp_exfiltration.py
Created October 7, 2020 15:13
ICMP Exfiltration
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from scapy.all import sniff, ICMP
def process_packet(packet):
if packet.haslayer(ICMP) and packet[ICMP].type == 0:
data = packet[ICMP].load[-8:]
try:
@maxrodrigo
maxrodrigo / pihole_blocklists.sh
Created October 20, 2021 22:11
Add blocklists to gravity.db with sqlite
curl https://v.firebog.net/hosts/lists.php?type=tick | \
xargs -I {} sqlite3 /etc/pihole/gravity.db "INSERT OR IGNORE INTO adlist (address, comment) VALUES ('{}','firebog');"
pihole -g
@maxrodrigo
maxrodrigo / git_file_prune.sh
Created September 15, 2021 06:28
Prune Git Repository
#!/usr/bin/env bash
FILE="$1"
git filter-branch --index-filter "git rm --cached --ignore-unmatch $FILE" --prune-empty --tag-name-filter cat -- --all
git for-each-ref --format="delete %(refname)" refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
@maxrodrigo
maxrodrigo / alpine_setup_answer_file.txt
Created May 10, 2021 12:23
Alpine Raspberry Pi Setup Answer File
# Keyboard layout and variant
KEYMAPOPTS="<KEYBOARDLAYOUT> <KEYBOARDVARIANT>"
# Hostname
HOSTNAMEOPTS="-n <HOSTNAME>"
# Network interfaces
INTERFACESOPTS="auto lo
iface lo inet loopback
@maxrodrigo
maxrodrigo / csv-to-json.sh
Created January 7, 2019 09:29
Convert csv to json with jq
jq --slurp --raw-input --raw-output \
'split("\n") | .[1:] | map(split(",")) |
map({"id": .[0],
"example": .[1],
"attribute": .[2]})' \
example.csv > example.json
@maxrodrigo
maxrodrigo / arch_packages.txt
Created December 10, 2020 21:57
Arch packages
base
linux
linux-firmware
base-devel
sudo
iwd
dhcpcd
man-db
vi
rxvt-unicode