Skip to content

Instantly share code, notes, and snippets.

View devynspencer's full-sized avatar
:octocat:

Devyn Spencer devynspencer

:octocat:
View GitHub Profile
@devynspencer
devynspencer / rename_all.sh
Created September 20, 2015 08:44
Example highlighting the use of a for loop to rename all file beginning with 720 and not ending with .mp4
for i in $(ls 720^*.mp4); do
mv $i{,.mp4}
done
@devynspencer
devynspencer / multitailrc.symlink
Last active September 21, 2023 19:37 — forked from homeyjd/.multitailrc
multitail color scheme
@devynspencer
devynspencer / ssh-group
Last active September 29, 2015 21:53
Open multiple ssh connections to a host using individual tmux panes, but within a single tmux window for sanity, finger-health, and glory!
#!/bin/bash
#
# description: creates a new tmux window and multiple ssh sessions based on given parameters.
# syntax: ssh_group [TARGET] [CONNECTIONS]
# example: open 4 ssh connections to host `unicorn.rainbow.pvt`
# ssh_group unicorn.rainbow.pvt 4
# note: use from within an existing tmux session
if [ -z "$1" ]; then
@devynspencer
devynspencer / find-example
Created October 7, 2015 05:09
Examples of the bash command.
# find all files with the executable bit set
find /dir -type f -executable
# find any files with the `.bmp` or the `.txt` file extension
find /home/user/Desktop -name '*.bmp' -o -name '*.txt'
# add the above to an array for later reference
list="$(find /home/user/Desktop -name '*.bmp' -o -name '*.txt')"
@devynspencer
devynspencer / -
Last active October 10, 2015 11:14
alias ctabs='chrome-cli list links | awk '"'"'{ print $2 }'"'"''
@devynspencer
devynspencer / config.rb
Created October 21, 2015 00:08
Middleman config
# extensions
activate :directory_indexes
activate :automatic_image_sizes
activate :blog
activate :minify_html
activate :syntax
activate :syntax, line_numbers: true
activate :livereload
activate :gzip
@devynspencer
devynspencer / hash_names.sh
Last active October 22, 2015 20:29
Rename all files in folder with extension to md5 hash.
#!/bin/bash
local extension=$1
for f in $(pwd)/*.$extension; do
local hash=$(md5 -q $f)
echo "renaming $f to $hash.$extension"
mv "$f" "$hash.$extension"
done
@devynspencer
devynspencer / autoindex_before.txt
Created October 23, 2015 23:50
1/2 - Wrapper for nginx autoindex page. Super pretty.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Package Repository Index</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha/css/bootstrap.min.css" type="text/css" />
<style>
h1 {
@devynspencer
devynspencer / autoindex_after.txt
Last active October 23, 2015 23:51
2/2 - Wrapper for nginx autoindex page. Super pretty.
<div class="row">
<div class="col-md-8 col-md-offset-2">
<p class="card-text text-center"><small class="text-muted">This index is automatically generated by nginx, and intended for troubleshooting purposes only. All packages must be installed on State of Oregon servers via the installed package manager. Remember: all installed software is audited to ensure security requirements are consistently met.</small></p>
</div>
</div>
</div>
</div>
</div>
</div>
@devynspencer
devynspencer / install_nginx.sh
Created October 23, 2015 23:52
Install nginx
#!/bin/bash
yum -y install gcc gcc-c++ make zlib-devel pcre-devel openssl-devel
version="${1:-1.8.0}"
config="${2:-$(pwd)/nginx.conf.default}"
cd /tmp
wget http://nginx.org/download/nginx-$version.tar.gz
tar -xzf nginx-$version.tar.gz