Skip to content

Instantly share code, notes, and snippets.

@ledger123
ledger123 / pg_extract.sh
Created January 30, 2024 15:07 — forked from fowum/pg_extract.sh
Extract all databases (or one by name) from a sql file created by pg_dumpall
#!/bin/bash
# extract all postgres databases from a sql file created by pg_dumpall
# this script outputs one .sql file for each database in the original .sql file
# unless you pass the name of a database in the dump
if [ $# -lt 1 ]
then
echo "Usage: $0 <postgresql sql dump> [dbname]" >&2
exit 1
fi
@ledger123
ledger123 / pg_extract.sh
Created January 9, 2022 01:42 — forked from brock/pg_extract.sh
Extract all databases (or one by name) from a sql file created by pg_dumpall
#!/bin/bash
# extract all postgres databases from a sql file created by pg_dumpall
# this script outputs one .sql file for each database in the original .sql file
# unless you pass the name of a database in the dump
if [ $# -lt 1 ]
then
echo "Usage: $0 <postgresql sql dump> [dbname]" >&2
exit 1
fi
@ledger123
ledger123 / mojo_debug_hack.pl
Created December 22, 2021 04:03 — forked from willsheppard/mojo_debug_hack.pl
Use mojolicious hooks to dump out debugging information
# DEBUGGING HACK
$t->app->hook(before_dispatch => sub { # for request
my $c = shift;
return unless $ENV{APP_DEBUG};
print "*** Request body = ".$c->tx->req->body."\n";
print "*** Request headers = ".$c->tx->req->content->headers->to_string."\n";
print "*** End of headers\n";
});
$t->app->hook(after_dispatch => sub { # for response
@ledger123
ledger123 / instructions.md
Created December 18, 2021 06:51 — forked from matthewjberger/instructions.md
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

@ledger123
ledger123 / wp-permissions-script
Created November 30, 2021 07:43 — forked from macbleser/wp-permissions-script
WordPress Permissions Configuration Script
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=changeme # &lt;-- wordpress owner
WP_GROUP=changeme # &lt;-- wordpress group
WP_ROOT=/home/changeme # &lt;-- wordpress root directory
@ledger123
ledger123 / README.md
Created October 30, 2021 10:44 — forked from miguelmota/README.md
Multiple accounts with Mutt E-Mail Client (gmail example)

How to set up multiple accounts with Mutt E-mail Client

Thanks to this article by Christoph Berg

Instructions

Directories and files

~/
@ledger123
ledger123 / centos_swapfile.sh
Created October 29, 2021 14:51 — forked from mortenbra/centos_swapfile.sh
Creating a swapfile suitable for Oracle XE on CentOS
# Oracle XE requires a swap file of at least twice the size of physical memory
# see https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-centos-6
# check current swap file
swapon -s
# check available space
df
# setup 2GB swap file
dd if=/dev/zero of=/swapfile bs=1024 count=2048k
@ledger123
ledger123 / dump.sh
Created October 18, 2021 06:19 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
sudo apt-get install libmoose-perl libtemplate-perl libmoosex-types-path-class-perl libdatetime-perl libdatetime-format-w3cdtf-perl libtemplate-plugin-html-strip-perl libdata-guid-perl
@ledger123
ledger123 / monitor.sh
Created December 8, 2020 03:02 — forked from chrisdlangton/monitor.sh
site monitor
#!/usr/bin/env bash
# script to check website status (online/ofline)
while read site
do
if wget -p "$site" -O /dev/null &>/dev/null; then
echo "$site is up"
else
# action to do if website offline
echo "[$(date +%d-%m-%Y:%H:%M:%S)] $site is not reachable." | ./slack-post.sh