Skip to content

Instantly share code, notes, and snippets.

@mritzco
mritzco / git_undo.sh
Created April 2, 2022 16:04
Undo the last local commit, fix and re-commit
git commit -m "Something terribly misguided" # (0: Your Accident)
git reset HEAD~ # (1)
#[ edit files as necessary ] # (2)
git add . # (3)
git commit -c ORIG_HEAD # (4)
#Ref: https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git
@mritzco
mritzco / .tmux.conf
Created September 15, 2021 09:20
tmux and VI custom config
#Tweak timing between key sequence
set -s escape-time 0
## active window title colors
set-window-option -g window-status-current-attr bright
# Set prefix to Ctrl-Space instead of Ctrl-b
unbind C-b
set -g prefix C-Space
bind Space send-prefix
@mritzco
mritzco / resize.sh
Created August 10, 2021 10:05
Lineman image resizing
#!/bin/bash
filetype=png
for i in *.$filetype; do
name=$(echo $i | sed 's/\.[^.]*$//')
echo "Processing: $i"
mkdir -p $name
convert $i -resize 700x700\> $name/700;
convert $i -resize 460x460\> $name/460;
@mritzco
mritzco / ip.sh
Created January 4, 2021 11:51
Find your true IP
# Find out true IP for DB access.
# Ref: https://www.digitalocean.com/community/questions/trusted-sources-not-allowing-connections-from-my-ip?comment=94488#
curl ifconfig.io
version: "3"
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
environment:
# - PMA_ARBITRARY=1
- MYSQL_ROOT_PASSWORD=root
- PMA_HOST=127.0.0.1
restart: always
@mritzco
mritzco / How to create Node cli executable from npm.md
Last active April 13, 2024 15:43
Create Node Package (cli) executable from npm scripts

Creating an executable NPM package and using it

This short guide explains how to create an NPM package that can be called as a script from another project. For clarity: The package to execute will be called: Module The place where you use it: Application

1. Build your module

Create a standard module ignore command line parsing

@mritzco
mritzco / convert.sh
Created July 28, 2019 07:16
PDF to text all files in a directory, plus some cleaning
#!/bin/bash
FILES=*.pdf
for f in $FILES
do
SAVEAS="${f/.pdf/.txt}"
if [ ! -f "librosTexto/$SAVEAS" ]; then
echo "-Processing $f file as $SAVEAS..."
pdftotext -enc UTF-8 -nopgbrk "$f" "librosTexto/tmp.txt"
tr -s '\t' ' ' <"librosTexto/tmp.txt" > "librosTexto/$SAVEAS"
rm librosTexto/tmp.txt
@mritzco
mritzco / miraclecast.sh
Created April 17, 2019 16:47
Installing miraclecast and dependencies on Linux Mint
# not really an sh file but the sequence I used to install, might work as .sh but haven't tried
# If running as .sh with sudo it might not need the sudo's
# 1. Clone the repo and create the directories
git clone https://github.com/albfan/miraclecast.git
cd miraclecast/
mkdir build
cd build/
# 2. There's lots of dependencies not listed
sudo apt-get install autoconf automake libtool libudev-dev libsystemd-dev libglib2.0-dev libreadline-dev
# 3. Continue the building process
@mritzco
mritzco / IconText.css
Created September 6, 2018 08:26
Using infernojs / reactjs components with transposed content
.text-wrapper {
margin: 0px 10px 0px 34px;
text-align: left;
}
@mritzco
mritzco / Instructions.md
Last active January 4, 2020 16:03
Installing TortoiseHG on linux (2018 PPA not working)

Installing TortoiseHG

(June 2018)

PPA for tortoise is gone and Tortoise is removed when mercurial is updated.

If you're ok having an old version of Mercurial, you can reinstall following this guide:

First let's see the requirements:

sudo apt-get install tortoisehg