Skip to content

Instantly share code, notes, and snippets.

@claymcleod
claymcleod / pycurses.py
Last active May 1, 2024 14:44
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@lornajane
lornajane / mac.md
Last active May 1, 2024 00:31
Keyboard Only OS X

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
@sighingnow
sighingnow / Makefile
Last active April 28, 2024 10:42
Detect operating system in Makefile.
# Detect operating system in Makefile.
# Author: He Tao
# Date: 2015-05-30
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OSFLAG += -D AMD64
endif
@angstwad
angstwad / dict_merge.py
Last active March 1, 2024 23:53
Recursive dictionary merge in Python
# Copyright 2016-2022 Paul Durivage
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Jenkinsfile VIM syntax highlighting
echo 'au BufNewFile,BufRead Jenkinsfile setf groovy' >> ~/.vimrc
@BretFisher
BretFisher / pcat-install.sh
Last active February 6, 2024 14:41
On macOS: Install pygmentize and alias pcat for shell code syntax highlighting
# first install pygmentize to the mac OS X or macOS system with the built-in python
sudo easy_install Pygments
# then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc.
alias pcat='pygmentize -f terminal256 -O style=native -g'
@yannvery
yannvery / CHRUBY_add_ruby_version.md
Last active December 8, 2023 00:51
CHRUBY - How to install a new ruby version

Install a new ruby version with chruby

OSX

First of all you must update ruby-build to update definitions list.

brew update

And update ruby-build

@9point6
9point6 / ssh-retry.sh
Last active April 22, 2023 08:44
Keep retrying SSH connection until success (Useful for waiting for VMs to boot)
#!/usr/bin/env bash
# Check we've got command line arguments
if [ -z "$*" ] ; then
echo "Need to specify ssh options"
exit 1
fi
# Start trying and retrying
((count = 100))
@xxxVxxx
xxxVxxx / gist:9648264fd6f41bbb1f65
Last active November 25, 2022 06:52
boto3 aws find all IAM accesskeys details for the account
import boto3
boto3.setup_default_session(profile_name='IAM')
resource = boto3.resource('iam')
client = boto3.client("iam")
KEY = 'LastUsedDate'
for user in resource.users.all():
@jgornick
jgornick / docker-cleanup.sh
Created May 20, 2016 19:07
Docker: Cleanup (Remove all exited containers and dangling images)
#!/bin/bash
docker rm $(docker ps -q -f status=exited)
docker rmi $(docker images -q -f dangling=true)