Skip to content

Instantly share code, notes, and snippets.

@lsd
lsd / maybe-useful-shell-zsh-aliases.md
Created November 25, 2015 01:13
a place to throw zsh/shell aliases - complete .shell_aliases and other dotfiles should be in a public github repo though

Long/interesting command you'd like bookmarked for later? append 'BK' to save it to the $bookmarks file. Add this to ie .zshrc

bookmarks='~/bookmarks.cmdline.sh'
alias -g BK='>> $bookmarks && wc -l $bookmarks'

Usage

  • echo NotInteresting BK
@lsd
lsd / bindkey-hhighlighter-zsh-bash-osx-f1-meta-keys.md
Last active November 24, 2015 11:01
my misc zsh hhighlighter snippets
@lsd
lsd / add_pgp_keys.sh
Created July 23, 2015 12:58
Function to add PGP keys by looping ~/.ssh/auto and ssh-shad
# line 5 is still noisy
# this won't block if ssh-add requires password. you will be prompted to enter it after loop
function add_pgp_keys {
for pgp in $(cat "$HOME/.ssh/auto"); do
echo $pgp
ssh-add "/Users/`whoami`/.ssh/$pgp" &2>1 > /dev/null
echo "ssh-add result: $?"
done
ssh-add -l
@lsd
lsd / update-plist.sh
Last active August 29, 2015 14:25
Wrapper around `plutil` to quickly jump between xml1 and binary1 when editing plists (propert lists in resources, Xcode)
#!/bin/sh
#
# A script to make it easier to edit resources in mac.apps on the commandline
# Isam M 2015 <http://github.com/lsd/update-plist.sh>
# exit if pipeline (1+ cmd) fails
set -e
echo
echo "USAGE (default English): To open ScreenCapture.strings in SystemUIServer.app/C/R/English.lproj
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Brian Mitchell</string>
<key>name</key>
<string>Monochromatic</string>
<key>settings</key>
<array>
@lsd
lsd / IdeaVim OS X Key Repeat.markdown
Last active October 11, 2024 02:21
Enable key-repeat for ALL applications or just for IdeaVim/specific JetBrains apps

Upgrading to Lion or Yosemite and WebStorm 9, I noticed key repeat was
turned off for the IdeaVim plugin h j k l keys.

System-wide key repeat

defaults write -g ApplePressAndHoldEnabled -bool false in a terminal will enable
key repeat for every app. This can alternatively be found in the accessibility settings in OS X' preferences.

App specific key repeat

@lsd
lsd / dota-2-console-commands.markdown
Last active January 5, 2024 13:08
DOTA 2 useful console commands

DOTA2 console commands

The most useful command here is probably dota_force_right_click_attack 1
More will be added as they come. The essentials DO NOT require sv_cheats
and as far as I know do not violate any official competition rules.

Turn on console

  • In steam, right cilck on "Dota 2" > properties
  • Click on Set Launcher Options and add -console
  • Save and start game. The default hotkey is ```` (backtick)
# one-liner example:
# perl -e '$r="1346518,CLOSED,04/09/2013 12:00:00 AM,136 EAST 27 STREET,1018152,555,,49,SPOPS,05/24/2013 12:00:00 AM,A8,05/22/2013 12:00:00 AM"; print "$r (orig)\n"; $rand=int(rand 5)+1; $r =~ s/(,[0-9]{7},)[0-9]+(,,..)/\1$rand\2/; print $r;'
# I broke it up into lines to make it easier to understand
$rand = int(rand 5) + 1;
$row = "1346518,CLOSED,04/09/2013 12:00:00 AM,136 EAST 27 STREET,1018152,555,,49,SPOPS,05/24/2013 12:00:00 AM,A8,05/22/2013 12:00:00 AM";
print "$row (old)\n";
@lsd
lsd / bulk-avail-namecheap-com.js
Created April 13, 2013 23:46
Display an overlay of available domains. Namecheap.com bulk "Domain Name Search" results page only.
/*Display an overlay of available domains. 01/13/2013 <http://github.com/lsd>*/
/*Namecheap.com bulk "Domain Name Search" results page only.*/
'use strict';
//var pre="Available Domains\n---\n",
var pre='',
style='z-index:9999;width:250px;height:100%;background:rgb(55,55,55);color:#ddd;font-size:16px;padding:5px;float:left;border:2px dashed #eee;position:fixed;font-family: Ubuntu, Verdana, Helvetica;';
none='empty results. is this is the namecheap.com search results page for BULK domains?',
px=" ",
sx="\n",
_d='<div style="margin:10px auto 10px 50%;left:0;top:0;position:fixed;z-index:9999999;"><pre id="availdomains" style="'+style+'";>'+none+'</pre></div>',
@lsd
lsd / 404 needs to shut the fuck up
Created January 30, 2013 23:56
backtrace_silencer.rb code to discard RoutingErrors from the logs
# Place me in <app>/config/initializers/backtrace_silencer.rb
# Be sure to restart your server when you modify this file.
# No more RoutingError exceptions clogging your logs.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!