Skip to content

Instantly share code, notes, and snippets.

@tsutsu
tsutsu / refresh.rb
Created February 17, 2020 16:47
Update all available package ecosystems
#!/usr/bin/env ruby
require 'pathname'
class << ENV
def path
@path ||= self['PATH'].split(':').map{ |d| Pathname.new(d) }
end
def which(cmd)
@tsutsu
tsutsu / README.md
Last active February 2, 2020 03:13

This is an example of a script for new systems, which 'mounts' dotfiles from a cloud-synced directory, and also moves junk out of the homedir into the places where it "should" live as per various filesystem standards (Linux FHS, FreeDesktop.org, macOS, etc.), replacing the origins with symlinks to the new locations.

The script is designed to be idempotent; it could theoretically be run on startup.

Various locations are hard-coded. Please take this script only as inspiration; don't try to run it directly.

@tsutsu
tsutsu / README.md
Last active January 31, 2020 18:11
More Stupid Bash Tricks

More Stupid Bash Tricks

Before we get started, let's make a ~/.bash directory

Bash expects just a few files in your homedir, but is fine with these files being symlinks. As such, I instead create a subdir, ~/.bash, and then symlink ~/.bashrc to ~/.bash/bashrc and ~/.bash_profile to ~/.bash/bash_profile. This gives you a new namespace (the ~/.bash dir) to pollute with little files, which we're going to do plenty of below.

Keybase proof

I hereby claim:

  • I am tsutsu on github.
  • I am tsutsu (https://keybase.io/tsutsu) on keybase.
  • I have a public key ASDpqX9IQfJgw5_x9cJL52ikKcmI5Iw67U4B5VJTra0O8wo

To claim this, I am signing this object:

@tsutsu
tsutsu / HOWTO-CoreOS-on-DO.md
Last active September 25, 2016 09:14
CoreOS on DigitalOcean (using "Debian 7 x64" as a base)
  1. run sudo apt-get install squashfs-tools kexec-tools
  2. copy "update.sh" to /usr/sbin/update-coreos, and make it executable
  3. copy "create-docker-store.sh" to /usr/sbin/create-coreos-docker-store, and make it executable
  4. copy "cloud-config.yml" to /etc/default/coreos, modifying it to suit your preferences
  5. run sudo update-coreos -d
  6. reboot
@tsutsu
tsutsu / capt
Created January 27, 2014 05:34
#!/usr/bin/env ruby
require 'fileutils'
require 'pathname'
require 'shellwords'
call_args = ARGV.join(' ')
desktop_dir = Pathname.new(ENV['HOME']) + 'Desktop'