Skip to content

Instantly share code, notes, and snippets.

View pocco81's full-sized avatar
🍁
I may be slow to respond.

pocco pocco81

🍁
I may be slow to respond.
  • Mars
View GitHub Profile
@pocco81
pocco81 / json.lua
Created August 26, 2022 16:14 — forked from tylerneylon/json.lua
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
@pocco81
pocco81 / nuke.sh
Created February 20, 2022 23:44 — forked from randomessence/nuke.sh
nuke it
#!/bin/bash
# Nuke it, baby
#
if [[ "$(hostname)" = 'metis' ]]
then
echo
echo -e "\033[36m""This is the metis slot, i am exiting""\e[0m"
echo
exit
@pocco81
pocco81 / GitCommitEmoji.md
Created January 6, 2022 04:41 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@pocco81
pocco81 / .bashrc
Created November 20, 2021 23:49 — forked from alexmurray/.bashrc
Show IP address in bash prompt
# Set the prompt to include the IP address instead of hostname
function get_ip () {
IFACE=$(ip -4 route | grep default | head -n1 | awk '{print $5}')
if [ ! -z $IFACE ]; then
echo -n "|"; ip -4 -o addr show scope global $IFACE | awk '{gsub(/\/.*/, "|",$4); print $4}' | paste -s -d ""
else
echo -n "||"
fi
}

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@pocco81
pocco81 / os.capture
Created September 15, 2021 03:12 — forked from dukeofgaming/os.capture
Capture console output from Lua system call
---
-- Function to retrieve console output
--
function os.capture(cmd, raw)
local handle = assert(io.popen(cmd, 'r'))
local output = assert(handle:read('*a'))
handle:close()
if raw then
@pocco81
pocco81 / alacritty-tmux-vim_truecolor.md
Created August 1, 2021 17:26 — forked from andersevenrud/alacritty-tmux-vim_truecolor.md
True Color and Italics w/alacritty + tmux + vim

This should make true-color and italics work in your tmux session.

Tested successfully in bash and zsh with latest packages from Arch (with exception of Neovim from Git) 20019-07-07.

Notes

  1. Don't use &t_8f and &t_8b in your vim config
  2. Don't set $TERM in your zshrc, bashrc, etc. Let your terminal set this. So far xterm-256color has worked best for me.

Testing colors

@pocco81
pocco81 / GitDeleteCommands.ps1
Created April 15, 2021 03:36 — forked from cmatskas/GitDeleteCommands.ps1
Git Delete Branch commands
## Delete a remote branch
$ git push origin --delete <branch> # Git version 1.7.0 or newer
$ git push origin :<branch> # Git versions older than 1.7.0
## Delete a local branch
$ git branch --delete <branch>
$ git branch -d <branch> # Shorter version
$ git branch -D <branch> # Force delete un-merged branches
## Delete a local remote-tracking branch
@pocco81
pocco81 / xterm-bg.sh
Created March 28, 2021 23:06 — forked from blueyed/xterm-bg.sh
Query background setting from terminal (xterm / rxvt-unicode)
#!/bin/sh
#
# Query a property from the terminal, e.g. background color.
#
# XTerm Operating System Commands
# "ESC ] Ps;Pt ST"
oldstty=$(stty -g)
# What to query?
#!/bin/bash
#sve = System Variable Exemplifier
#This script executes whatever file you tell regardless of in which directory it's currently in.
script_help=$( cat << EOF
This script executes whatever file you tell regardless of
in which directory it's currently in. In order or execution,