Skip to content

Instantly share code, notes, and snippets.

View devynspencer's full-sized avatar

Devyn Spencer devynspencer

View GitHub Profile
@tdd
tdd / gitconfig.ini
Last active April 17, 2024 10:04
Nice, useful global Git configuration
# Put this in your ~/.gitconfig or ~/.config/git/config
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName>
[user]
name = Your Full Name
email = your@email.tld
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
# List available aliases
@kaimallea
kaimallea / Find Manual Drive Mappings
Created March 22, 2011 15:29
A PowerShell (v2) script to iterate through a list of computers and identify manual mappings for each user profile. Hopefully, you've followed best practices and won't need to run this in your environment. ;)
<#
Find Manual Drive Mappings
Created Mar. 19 2011 by Kai Mallea (kmallea@gmail.com)
License: http://www.opensource.org/licenses/mit-license.php
#>
@halkeye
halkeye / sorted_json.rb
Created April 2, 2012 23:13
Puppet module for outputting json in a sorted consistent way
#
# sorted_json.rb
# Puppet module for outputting json in a sorted consistent way. I use it for creating config files with puppet
require 'json'
def sorted_json(json)
if (json.kind_of? String)
return json.to_json
elsif (json.kind_of? Array)
@averyvery
averyvery / seeds.rb
Created April 11, 2012 19:27
Seeding images in Rails
# encoding: utf-8
environment_seed_file = File.join(Rails.root, 'db', 'seeds', "#{Rails.env}.rb")
def seed_image(file_name)
File.open(File.join(Rails.root, "/app/assets/images/seed/#{file_name}.jpg"))
end
products = [
{:name => 'foo', :description => 'lorem ipsum', :product_type => ProductType.find_by_name('Sandwiches')},
@nailor
nailor / multitmux.sh
Created April 19, 2012 12:45
Open ssh connections from stdin to multiple tmux panes
multitmux() {
read first;
tmux -q new-session -d -s $1 "ssh -t $first";
tmux set-option quiet on
tmux -q set-option -t $1 mouse-select-pane on
tmux -q set-window -g -t $1 synchronize-panes on
while read host; do
tmux -q split-window -p 25 -v -t $1 "ssh -t $host" 2>/dev/null;
if [ "$?" == "1" ]; then
# If pane is too small, change layout and retry opening
@diyan
diyan / gist:2850866
Created June 1, 2012 09:54
Python with PowerShell Remoting (Windows equivalent for Unix ssh sessions)
# Note that target_env.login and target_env.password is global variables
# Maybe I should add this into Fabric project (http://docs.fabfile.org/en/1.4.2/index.html).
# This is complicated task for sure but it would be nice if Fabric could use ssh under Linux and PowerShell Remoting under Windows.
def remote_sh(target_host, command_text, ignore_error=False):
print('run PowerShell script block at {0}: {1}'.format(target_host, command_text))
command_text = command_text.replace('"', '\'')
@phred
phred / pedantically_commented_playbook.yml
Last active June 27, 2024 13:39
Very complete Ansible playbook, showing off all the options
---
####
#### THIS IS OLD AND OUTDATED
#### LIKE, ANSIBLE 1.0 OLD.
####
#### PROBABLY HIT UP https://docs.ansible.com MY DUDES
####
#### IF IT BREAKS I'M JUST SOME GUY WITH
#### A DOG, OK, SORRY
####
@andsens
andsens / bootstrap_homeshick.sh
Last active December 27, 2023 12:47
Script that can set up an entire user account with homeshick automatically
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@dmytro
dmytro / ssh-multi.sh
Created October 31, 2012 03:46
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi
# D.Kovalov
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# a script to ssh multiple servers over multiple tmux panes
starttmux() {
if [ -z "$HOSTS" ]; then