Skip to content

Instantly share code, notes, and snippets.

View crittelmeyer's full-sized avatar

Chris Rittelmeyer crittelmeyer

  • Olive
  • Atlanta, GA
View GitHub Profile
@crittelmeyer
crittelmeyer / linux_tools.md
Last active October 31, 2021 08:55
linux tools cheatsheet

Linux tools to know

Built-in Mac OS tools

  • ls - list directory contents
  • wc - word, line, character, and byte count
  • cp - copy files
  • mv - move files
  • rm - remove directory entries
  • chmod - change file modes or Access Control Lists
  • chown - change file owner and group
@crittelmeyer
crittelmeyer / grep_cheatsheet.md
Last active May 22, 2020 07:50
grep cheatsheet

Differences between grep, pgrep, egrep, and fgrep (Linux):

grep

grep is an acronym that stands for "Global Regular Expressions Print". grep is a program which scans a specified file or files line by line, returning lines that contain a pattern. A pattern is an expression that specifies a set of strings by interpreting characters as meta-characters. For example the asterisk meta character (*) is interpreted as meaning "zero or more of the preceding element". This enables users to type a short series of characters and meta characters into a grep command to have the computer show us what lines in which files match.

The standard grep command looks like:

grep '' grep prints the search results to the screen (stdout) and returns the following exit values:

0 A match was found.

#!/usr/bin/python
# Adapted from http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html
import getpass
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
@crittelmeyer
crittelmeyer / tmux_cheatsheet.markdown
Last active September 27, 2023 19:37 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux/tmuxinator cheatsheet

tmux

As configured in my dotfiles, here and here.

Command line

$ tmux                           -> start new
$ tmux new -s myname             -> start new w/session name
$ tmux a  #  (or at, or attach)  -> attach
$ tmux a -t myname               -> attach to named
@crittelmeyer
crittelmeyer / gist:169b83e6c2037457908e
Created June 16, 2015 18:23
I'm watching you... #prank
crontab -e
*/30 * * * * say -v whisper "I am watching you"
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@crittelmeyer
crittelmeyer / rain.sh
Last active October 11, 2015 21:10 — forked from livibetter/README.md
#!/bin/bash
# Let it Rain!
# Copyright (C) 2011, 2013 by Yu-Jie Lin
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
_
_._ _..._ .-', _.._(`))
'-. ` ' /-._.-' ',/
) \ '.
/ _ _ | \
| a a / |
\ .-. ;
'-('' ).-' ,' ;
'-; | .'
\ \ /
@crittelmeyer
crittelmeyer / open-tab
Last active November 11, 2022 08:06
Shell script to open a new Mac OS X terminal tab.
#!/bin/bash -e
osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
@crittelmeyer
crittelmeyer / git-ignore-all
Last active April 12, 2017 14:36
Shell script that adds all untracked files to .gitignore
#!/bin/bash -e
git status -s | grep -e "^??" | cut -c 4- >> .gitignore