Skip to content

Instantly share code, notes, and snippets.

@jdstapleton
jdstapleton / ubuntu-terminal-window-visible-toggle
Last active August 20, 2020 19:26
This is a script to mimimize or activate the gnome terminal that can be used as part of a global hotkey in the gnome keyboard shortcut preferences
#!/usr/bin/env python3
# Source: https://gist.github.com/jdstapleton/f7e252eb2a64ce0dd1a57eec075cee3b
# Installation:
# - copy this script somewhere on your machine, and set its executable bit
# - install `xdotool`, and `wmctrl` using your favorite package manager
# - Go to the Keyboard Shortcuts control panel
# - Scroll to the bottom to the 'Custom Shortcuts' section, click the `+` button
# - `Name` to be 'Terminal' or something similar
# - `Command` to be the path to the script where you copied it to.
@jdstapleton
jdstapleton / listening.sh
Created September 3, 2014 23:33
listening.sh
# Mac OSX:
listening () {
lsof -Pni | grep '(LISTEN)' | awk 'BEGIN {printf "%-15s %5s %21s\n", "Command", "PID", "PORT"} {printf "%-15s %5s %21s\n", $1,$2,$9}'
}
# Linux (if you want non-you processes that are listening):
listening () {
sudo lsof -Pni | grep '(LISTEN)' | awk 'BEGIN {printf "%-15s %5s %21s\n", "Command", "PID", "PORT"} {printf "%-15s %5s %21s\n", $1,$2,$9}'
}
@jdstapleton
jdstapleton / VagrantFile
Created August 20, 2014 00:18
~/.vagrant.d/VagrantFile
Vagrant.configure("2") do |config|
config.vm.synced_folder "~/.m2", "/home/vagrant/.m2"
if Vagrant.has_plugin?("vagrant-cachier")
# Configure cached packages to be shared between instances of the same base box.
# More info on the "Usage" link above
config.cache.scope = :box
config.cache.enable :generic, {
"www" => { cache_dir: "/var/cache/www" },
}
require 'rubygems'
require 'right_aws'
aws_access_key_id = 'your-access-key'
aws_secret_access_key = 'your-secret-key'
target_bucket = 'your-source-bucket'
destination_bucket = 'your-destination-bucket'
s3 = RightAws::S3Interface.new(aws_access_key_id, aws_secret_access_key)