Skip to content

Instantly share code, notes, and snippets.

View dallasspohn's full-sized avatar
🏠
Working from home

Dallas Spohn dallasspohn

🏠
Working from home
View GitHub Profile
@dallasspohn
dallasspohn / hangman.py
Created September 25, 2020 14:21
A Hangman game written in Python
import random
HANGMANPICS = ['''
+---+
| |
|
|
|
@dallasspohn
dallasspohn / monitor.sh
Created February 18, 2020 15:16
The monitor script runs until terminated. It generates artificial CPU load by performing fifty thousand addition problems. It then sleeps for one second, resets the variable, and repeats.
#!/bin/bash
while true; do
var=1
while [[ var -lt 50000 ]]; do
var=$(($var+1))
done
sleep 1
done
@dallasspohn
dallasspohn / display_git_branch.sh
Last active March 4, 2020 05:07
Quick and dirty env variable to show repos/branched in the terminal prompt. Just paste in current shell.
Different styles.
#Shows User@HOSTNAME
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h\[\033[32m\] \[\033[33;1m\]\w\[\033[m\] (\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)) \$ "
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\] \[\033[33;1m\]\w\[\033[m\] (\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)) \$ "
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \w\[\033[0;32m\] - [$(git branch 2>/dev/null | grep "^*" | colrm 1 2)\[\033[0;32m\]]\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] '
@dallasspohn
dallasspohn / fix_usb.sh
Created February 3, 2020 15:12
I screw up my usb sticks. a lot!!! This reformats them.
#!/bin/sh
# This small script will fix the "missing space" caused by dd-ing fatdog isohybrid to a flash drive
# making the rest of the space available again for use.
# Only run this after dd-ing fatdog iso and not after anything else.
# (C) jamesbond 2013, Jake SFR 2018
#set -x
### configuration
#RESERVED_SPACE=1048576 # reserve 512MB (1024k secotors) by default, it will be made larger if necessary.
@dallasspohn
dallasspohn / image_scale.py
Last active January 25, 2020 06:31
Resize or scale images.
#!/usr/bin/python
from PIL import Image
import os, sys
path = "/path/to/images/"
dirs = os.listdir( path )
def resize():
for item in dirs:
if os.path.isfile(path+item):
@dallasspohn
dallasspohn / super_keybinding.py
Created January 20, 2020 21:53
super_keybinding for rhel
#!/usr/bin/env python3
import subprocess
import sys
# defining keys & strings to be used
key = "org.gnome.settings-daemon.plugins.media-keys custom-keybindings"
subkey1 = key.replace(" ", ".")[:-1]+":"
item_s = "/"+key.replace(" ", "/").replace(".", "/")+"/"
firstname = "custom"
# get the current list of custom shortcuts
@dallasspohn
dallasspohn / super_paste.py
Last active January 19, 2020 19:45
Copy and paste between web windows.
#!/usr/local/bin/python
# This script takes what is in the clipboard and uses key press to
# paste on the focused window. I use this for pasting into a web
# termianl
# I have it set to run at a keypress.
import pyautogui as pya
import pyperclip
import time
# Pythono3 code to rename multiple
# files in a directory or folder
import os
# Function to rename multiple files
def main():
i = 0
for filename in os.listdir("xyz"):
@dallasspohn
dallasspohn / re_repofiles.py
Created July 30, 2019 15:34
Creates a list of artifacts from a manifest output. Looks at MISSING and EXISTS. Drops the EXIST artifact and sets the MISSING in a list so I can rsync from lacrosse.
import re
'''Good to run on all'''
with open('repofiles_raw.txt') as repofile:
x=repofile.readlines()
done=[]
newline=''.join([str(i) for i in x])
@dallasspohn
dallasspohn / .bash_profile
Created June 29, 2019 04:21
my bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH=/home/dallas/.rbenv/plugins/ruby-build/bin:/home/dallas/.rbenv/shims:/home/dallas/.rbenv/bin:/home/dallas/bin:/home/dallas/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/dallas/.rvm/bin:/home/dallas/.rvm/bin:/home/dallas/.vimpkg/bin
# Set CLICOLOR if you want Ansi Colors in iTerm2
export CLICOLOR=1
#source /Users/dallas/.git-prompt.sh
#source /Users/dallas/.bash_colors