Skip to content

Instantly share code, notes, and snippets.

View jonnyhtw's full-sized avatar
💭
eating cheese

Jonny Williams jonnyhtw

💭
eating cheese
  • Wellington, New Zealand
  • 22:51 (UTC -12:00)
View GitHub Profile
@TiddoLangerak
TiddoLangerak / getCurrentWindowCWD.sh
Last active February 19, 2022 08:07
Script to get the CWD of the current active window, with support for shells running tmux. This can be used to launch new terminals in the same cwd as the current one.
#!/bin/bash
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
# Inspired by https://gist.github.com/viking/5851049 but with support for tmux
CWD=''
# Get window ID
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
# Get PID of process whose window this is
@JohannesBuchner
JohannesBuchner / rsyncprogress.py
Last active June 18, 2023 18:51
Progress bar for rsync
"""
Progress bar for rsync
========================
Shows file progress and total progress as a progress bar.
Usage
---------
Run rsync with -P and pipe into this program. Example::
@jrziviani
jrziviani / mutt.txt
Last active September 5, 2022 16:30
mutt cheat sheet
Mutt
http://www.mutt.org/doc/manual/manual.html
Select (tag) messages: shift+t (T)
= (string)
~ (expression)
~b expr (message with expr in body)
[b]body
@facundofarias
facundofarias / mutt_on_osx.sh
Created January 3, 2017 10:55
Installing and configuring Mutt on OSX
# Install mutt using brew
$ brew install mutt
# Configure mutt
$ vim ~/.muttrc
# Put the following on the mutt config file (.muttrc)
set imap_user = “YOUR_USERNAME@GMAIL_OR_YOUR_DOMAIN.com”
set imap_pass = “YOUR_PASSWORD”
set smtp_url = “smtp://YOUR_USERNAME@GMAIL_OR_YOUR_DOMAIN@smtp.gmail.com:587/”
@keithweaver
keithweaver / create-folder.py
Created March 10, 2017 03:42
Create a folder with Python
import os
def createFolder(directory):
try:
if not os.path.exists(directory):
os.makedirs(directory)
except OSError:
print ('Error: Creating directory. ' + directory)
@Benbb96
Benbb96 / color_contrast.py
Last active July 19, 2022 12:53
Original PHP script from this stackoverflow question : https://stackoverflow.com/a/42921358/8439435 then updated to Python and following the WCAG 2.0 - G18.
BLACK_COLOR = "#000000"
WHITE_COLOR = "#FFFFFF"
def get_contrast_color(background_color: str) -> str:
"""
Util function to determine what's the best color between black or white to choose for a text
depending on the background color given in parameter.
Based on algorythm from WCAG 2.0 explained here : https://www.w3.org/TR/WCAG20-TECHS/G18.html#G18-tests
:param background_color: the background color in HEX format (eg: #9D412B)