Skip to content

Instantly share code, notes, and snippets.

@rnetonet
rnetonet / postgres-cheatsheet.md
Created May 22, 2025 16:51 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@rnetonet
rnetonet / mvn-clean-recursive
Last active January 8, 2025 10:18 — forked from mkutz/mvn-clean-recursive
Bash script to execute mvn clean for all sub directories containing a pom.xml
Get-ChildItem -Directory | ForEach-Object {
Set-Location $_.FullName
mvn dependency:purge-local-repository
Set-Location ..
}
@rnetonet
rnetonet / delete-git-recursively.sh
Created June 18, 2024 22:42 — forked from facelordgists/delete-git-recursively.sh
Recursively remove .git folders
( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf
@rnetonet
rnetonet / RPi3-Auto-WiFi.md
Created April 26, 2024 11:58 — forked from carry0987/RPi3-Auto-WiFi.md
Raspberry Pi 3B+ Auto reconnect to wifi when lost connect

Auto reconnect to wifi when lost connection

Before you start, make sure ip command is available on your system. In modern Linux distributions, ip replaces older ifconfig command. If net-tools package (that includes ifconfig) is not installed and you prefer using it, you can install it via sudo apt-get install net-tools.

Create script file

Use touch /home/pi/wifi-reconnect.sh to create a shell script file, with the following content:

#!/bin/bash
@rnetonet
rnetonet / boolparser.py
Created April 22, 2024 16:53 — forked from leehsueh/boolparser.py
Python Boolean Expression Parser/Evaluator
"""
Grammar:
========
Expression --> AndTerm { OR AndTerm}+
AndTerm --> Condition { AND Condition}+
Condition --> Terminal (>,<,>=,<=,==) Terminal | (Expression)
Terminal --> Number or String or Variable
Usage:
======
@rnetonet
rnetonet / simpleBool.py
Created April 22, 2024 16:52 — forked from kampta/simpleBool.py
Code to evaluate simple boolean logic in python using pyparsing
#
# simpleBool.py
#
# Example of defining a boolean logic parser using
# the operatorGrammar helper method in pyparsing.
#
# In this example, parse actions associated with each
# operator expression will "compile" the expression
# into BoolXXX class instances, which can then
# later be evaluated for their boolean value.
@rnetonet
rnetonet / update-moodle.sh
Created March 2, 2024 22:36 — forked from michael-milette/update-moodle.sh
Update Moodle version
# Script: update-moodle.sh
# From: https://gist.github.com/
# This script will update Moodle within the same major version (example: 3.6.1 to 3.6.3).
# The nice thing about this simple approach is that it won't affect your plugins.
# Assumes you used "git clone" to create and install your instance of Moodle. If you did not, don't use this script!
#
# Copyright TNG Consulting Inc.
# Author: Michael Milette - <www.tngconsulting.ca>
# Release: 1.0 Alpha - 2019-04-16
#
@rnetonet
rnetonet / moodle_upgrade.sh
Created March 2, 2024 22:36 — forked from derhofbauer/moodle_upgrade.sh
Bash Moodle Upgrade Script
#!/bin/sh
echo "This script updates your moodle installation."
echo "You will need a few pieces of information to complete this process."
echo ""
echo "Warning: This will disable Web-Access to the moodle installation!"
echo "Make sure nobody is logged in at the moment or activate maintenance mode manually so no data is lost."
echo ""
echo ""
@rnetonet
rnetonet / compress-mp4.sh
Created May 31, 2023 18:12 — forked from chamalis/compress-mp4.sh
Compress video files recursively, using x264, placing the output files into the same folder with an appropriate filename (filename_scaled.mp4). First argument is the top-level directory to scan. It avoid overriding already compressed files. Change the filetype (e.g mp4) at the beginning of the script.
#!/bin/bash
FILETYPE=mp4
if [ "$#" -ne 1 ]; then
echo "Usage: <path-to-compress.mp4> target-top-level-directory"
exit
fi
# for all the mp4 except the already scaled ones