Skip to content

Instantly share code, notes, and snippets.

Andy Stewart airblade

Block or report user

Report or block airblade

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@airblade
airblade / raspbian.md
Last active Jan 7, 2020
Pi hole stuff
View raspbian.md
  • Download latest Raspbian Lite (currently Buster) from here.

  • Plug SD card into computer.

  • Unzip Raspbian image and install on SD card. This should overwrite everything on the SD card; it shouldn't be necessary to format first.

    diskutil list  # make note of disk of SD card; eg. disk4
    diskutil unmountDisk /dev/disk4
    sudo dd bs=1m if=<path of raspbian image> of=/dev/rdisk4 conv=sync  # rdisk4 is  faster than disk4
    
@airblade
airblade / vimrc
Created Apr 5, 2019
Using vim-gitgutter to achieve niklaas/lightline-gitdiff
View vimrc
let g:gitgutter_signs=0
function! GitStatus()
return join(filter(map(['A','M','D'], {i,v -> v.': '.GitGutterGetHunkSummary()[i]}), 'v:val[-1:]'), ' ')
endfunction
set statusline+=%{GitStatus()}
@airblade
airblade / karabiner.json
Last active Jan 18, 2018
Karabiner-Elements
View karabiner.json
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@airblade
airblade / export.rb
Created Jan 8, 2018
Exports Photos.app v1.5 albums and their photos to plain directories and files.
View export.rb
#!/usr/bin/env ruby
# Exports albums and their photos to plain directories and files.
#
# Built for Photos.app v1.5 on OS X 10.11.6.
#
# See also:
# https://github.com/koraktor/gallerist
#
# TODO:
@airblade
airblade / private.xml
Last active Nov 30, 2017
Karabiner (not Karabiner-Elements)
View private.xml
<?xml version="1.0"?>
<root>
<item>
<name>Change Plus-minus key</name>
<appendix>Plusminus to underscore</appendix>
<identifier>private.plusminus_to_underscore_r</identifier>
<autogen>
__KeyToKey__
KeyCode::UK_SECTION, ModifierFlag::SHIFT_R,
View gitgutter.log
==== start log session ====
0.000024 function gitgutter#process_buffer[10]..gitgutter#diff#run_diff[73]..gitgutter#utility#system[1]:
0.000024 cd /Users/cody && (git ls-files --error-unmatch .vimrc && (git -c "diff.autorefreshindex=0" diff --no-ext-diff --no-color -U0 -- .vimrc | grep --color=never -e '^@@ ' || exit 0))
==== start log session ====
0.000042 function gitgutter#process_buffer[10]..gitgutter#diff#run_diff[73]..gitgutter#utility#system[1]:
@airblade
airblade / shuffle.vim
Last active May 13, 2016
Shuffle a list in VimL
View shuffle.vim
" Shuffles list in place.
function! Shuffle(list)
" Fisher-Yates-Durstenfeld-Knuth
let n = len(a:list)
for i in range(0, n-2)
let j = Random(0, n-i-1)
let e = a:list[i]
let a:list[i] = a:list[i+j]
let a:list[i+j] = e
endfor
@airblade
airblade / private.xml
Created Jan 6, 2016
Change § key to # via Karabiner
View private.xml
<?xml version="1.0"?>
<root>
<item>
<name>Change Section key</name>
<appendix>Section to Hash</appendix>
<identifier>private.section_to_hash</identifier>
<autogen>
__KeyToKey__
KeyCode::DANISH_DOLLAR,
@airblade
airblade / copy_attachments.rb
Created Nov 10, 2015
Copies S3-stored Paperclip attachments from one AR model to another
View copy_attachments.rb
# lib/paperclip/copy_attachments.rb
# Copies S3-stored Paperclip attachments from one AR model to another.
#
# This module should be mixed into the target AR model.
if Gem::Version.new(::AWS::VERSION) >= Gem::Version.new(2)
raise NotImplementedError, 'coded for aws-sdk v1'
end
@airblade
airblade / macvim.rb
Created Dec 11, 2014
Homebrew formula for MacVim with patches to bring MacVim's patchlevel up to 542.
View macvim.rb
require 'formula'
# Reference: https://github.com/b4winckler/macvim/wiki/building
class Macvim < Formula
homepage 'http://code.google.com/p/macvim/'
url 'https://github.com/b4winckler/macvim/archive/snapshot-73.tar.gz'
version '7.4-73'
sha1 'b87e37fecb305a99bc268becca39f8854e3ff9f0'
revision 1
You can’t perform that action at this time.