Skip to content

Instantly share code, notes, and snippets.

@pixelpogo
pixelpogo / gist:1222411
Created September 16, 2011 15:50
How to simulate low bandwidth on mac os x
# try
# 48kbit/s for Dialup
# 64kbit/s for Edge
# 384kbit/s for 3G
# 768kbit/s for DSL
# 1572kbit/s for T1
#
# to simulate low bandwidths.
#
# And: You can play with the delay option.
@pixelpogo
pixelpogo / gist:1227729
Created September 19, 2011 21:55
How to install mysql gem on Mac OS X Lion 10.7
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
env ARCHFLAGS="-arch x86_64" gem install mysql -v='2.8.1' -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config
# and add this line to your .bash_profile
# export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
@pixelpogo
pixelpogo / gist:4510898
Created January 11, 2013 14:09
How to show a specific line in a large file.
An example:
During the import of a big sql-dump MySQL encountered an error in Line 8131086:
ERROR 1449 (HY000) at line 8131086: The user specified as a definer ('foo'@'%') does not exist
To fix that problem I had to have a look at this specific line and, to get the context, ten lines before and after that line.
This is how I did it:
$ sed -n '8131076,8131096p' ~/Downloads/dump_2012-12-17.sql
@pixelpogo
pixelpogo / gist:4512453
Last active December 10, 2015 23:49
additions to the default mysql configuration
# add this to your my.cnf
# in [mysqld]:
innodb_file_per_table # one file for each table
skip-character-set-client-handshake # ignore other charsets than utf8
collation_server=utf8_unicode_ci
character_set_server=utf8
default_storage_engine=INNODB
@pixelpogo
pixelpogo / gist:5064183
Last active December 14, 2015 09:19
Get a list of all your EC2 instances in all AWS regions
require "rubygems"
require "aws-sdk"
require "hirb"
extend Hirb::Console
ec2 = AWS::EC2.new(
:access_key_id => 'YOUR_ACCESS_KEY_ID',
:secret_access_key => 'YOUR_SECRET_ACCESS_KEY')
@pixelpogo
pixelpogo / gist:5229541
Last active December 15, 2015 08:19
Install drush in your Uberspace account
# In your Uberspace account's $HOME directory do...
# Clone drush git repo
git clone --branch master http://git.drupal.org/project/drush.git
# Checkout the correct git branch
cd drush && git checkout 8.x-6.x
# Add drush/bin/drush to your .zshrc/.bashrc/.bash_profile file
echo "export PATH=$PATH:$HOME/drush" | cat >> ~/.zshrc
@pixelpogo
pixelpogo / gist:5229558
Created March 23, 2013 22:20
Install Z Shell (oh-my-zsh) in your Uberspace account
# download and install Oh-my-ZSH
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
# make zsh your default shell
chsh -s /bin/zsh

Keybase proof

I hereby claim:

  • I am pixelpogo on github.
  • I am pixelpogo (https://keybase.io/pixelpogo) on keybase.
  • I have a public key whose fingerprint is 9483 351B 825B EE02 3AD2 9889 ED80 7C71 E623 BD51

To claim this, I am signing this object:

divvy://import/YnBsaXN0MDDUAQIDBAUGfX5YJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoK8QFAcIFSwtND0+R0hQUVlaZWZvcHh5VSRudWxs0gkKCxRaTlMub2JqZWN0c1YkY2xhc3OoDA0ODxAREhOAAoAFgAeACYALgA2AD4ARgBPdFhcYGRoKGxwdHh8gISIjJCUmJyMmIikqJCtYc2l6ZVJvd3NfEA9zZWxlY3Rpb25FbmRSb3dfEBFzZWxlY3Rpb25TdGFydFJvd1pzdWJkaXZpZGVkVmdsb2JhbF8QEnNlbGVjdGlvbkVuZENvbHVtbldlbmFibGVkW3NpemVDb2x1bW5zV25hbWVLZXlca2V5Q29tYm9Db2RlXxAUc2VsZWN0aW9uU3RhcnRDb2x1bW5da2V5Q29tYm9GbGFncxAKEAkQAAgJgAQJgAMQfhIAnAAAVEZ1bGzSLi8wMVokY2xhc3NuYW1lWCRjbGFzc2VzWFNob3J0Y3V0ojIzWFNob3J0Y3V0WE5TT2JqZWN03RYXGBkaChscHR4fICEiIyQlJic4JiI6OyQ8CAmABBAGCYAGEHsSAJwAAFg2NiUgbGVmdN0WFxgZGgobHB0eHyAhIiMkJSYnIyYiQ0RFRggJgAQJgAgQfBADEgCcAABZNjYlIHJpZ2h03RYXGBkaChscHR4fICEiIyQlJSdMJiJOTyQkCAiABBAECYAKEAxUTGVmdN0WFxgZGgobHB0eHyAhIiMkJSUnIyYiVldYJAgIgAQJgAwQIxAFVVJpZ2h03RYXGBkaChscHR4fICEiW1wlJidgJiJiY1xkEAgQAQgJgAQQBwmADhB9EgCcAABaQ2VudGVyaXplZN0WFxgZGgobHB0eHyAhIiMkJSYnaiYibG0kbggJgAQQAgmAEBB7EgCeAABcTGVmdCAoc21hbGwp3RYXGBkaChscHR4fICEiIyQlJicjJiJ1dmB3CAmABAmAEhB8EgCeAABdUmlna
@pixelpogo
pixelpogo / copy-url.js
Last active May 21, 2019 07:56
Bookmarklet: Copy URL with title
javascript:(function()%7B%20window.prompt(%22URL%20with%20title%22,%20document.title%20+%20%22%5Cn%22%20+%20window.location.href);%7D());