Skip to content

Instantly share code, notes, and snippets.

lsd / gist:4634710
Last active December 11, 2015 17:28
How to recreate the MBP Retina low FPS issue
Originally posted/edited by "Boan" on 9/26/12 11:17 PM (PDT)
I've figured out how to recreate the low frame rate problem on my MBPR.
1) Connect the power adapter to the MBPR. Make sure the light on the connector is turned on.
2) Reset SMC to clear the problem. Press the Shift-Control-Option keys (on left side of built-in keyboard) and the power button at the same time.
3) Turn on the MBPR.
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!
lsd / bulk-avail-namecheap-com.js
Created April 13, 2013 23:46
Display an overlay of available domains. bulk "Domain Name Search" results page only.
/*Display an overlay of available domains. 01/13/2013 <>*/
/* 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 search results page for BULK domains?',
px=" ",
_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>',
# 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 / 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)
lsd / IdeaVim OS X Key Repeat.markdown
Last active May 3, 2024 07:22
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

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Brian Mitchell</string>
lsd /
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)
# A script to make it easier to edit resources in mac.apps on the commandline
# Isam M 2015 <>
# exit if pipeline (1+ cmd) fails
set -e
echo "USAGE (default English): To open ScreenCapture.strings in
lsd /
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: $?"
ssh-add -l
lsd /
Last active November 24, 2015 11:01
my misc zsh hhighlighter snippets