Skip to content

Instantly share code, notes, and snippets.

@maciakl
maciakl / gist:4531580
Last active April 20, 2021 11:17
Adding Ubuntu PPA repository behind a firewall. When you are behind a corporate firewall that only allows outbound traffic on ports 80 and 433 the usual apt-add-repository command will not work. To get around it. Here is the workaround.
# trying to install PPA behind firewall fails:
$ sudo add-apt-repository ppa:chris-lea/node.js
gpg: requesting key C7917B12 from hkp server keyserver.ubuntu.com
gpgkeys: HTTP fetch error 7: couldn't connect to host
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
recv failed
# this is how you get around it (use the key from the command above)
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C7917B12
@maciakl
maciakl / gist:4533283
Created January 14, 2013 20:47
Using git and git dependent packages (like bower, yeoman, etc..) behind a corporate firewall that allows only http and outbound https traffic.
# force git to always use https instead of ssh
git config --global url."https://".insteadOf git://
@maciakl
maciakl / gruntfile.js
Last active December 11, 2015 04:48
Gruntfile with JSHint rules defined for development with jQuery, Google Maps and Underscore.js. Also some sanity aiding rules for working with less than pristine code that has tab/space and curly brace placement inconsistencies you don't feel like linting for.
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
lint: {
files: [ 'grunt.js',
'lib/**/*.js',
'src/**/*.js'
]
@maciakl
maciakl / gist:4554048
Last active December 11, 2015 05:39
Ubuntu 10.4 PPA's
# Vim 7.3
sudo add-apt-repository ppa:infie/vim-lucid
# php 5.4
sudo add-apt-reposotory ppa:ondrej/php5
# wine 1.4
sudo add-apt-repository ppa:ubuntu-wine/ppa
@maciakl
maciakl / mvim
Created January 17, 2013 06:19 — forked from alanstevens/mvim
Run GUI MacVim from the terminal by typing in mvim. Why? Because the GUI version sometimes looks and handles better. I also usually alias gvim to this just so that I dom't mess up when I run it out of habit.
#!/bin/sh
#
# This shell script passes all its arguments to the binary inside the
# MacVim.app application bundle. If you make links to this script as view,
# gvim, etc., then it will peek at the name used to call it and set options
# appropriately.
#
# Based on a script by Wout Mertens and suggestions from Laurent Bihanic. This
# version is the fault of Benji Fisher, 16 May 2005 (with modifications by Nico
# Weber and Bjorn Winckler, Aug 13 2007).
@maciakl
maciakl / gist:4571295
Created January 19, 2013 07:53
The Dashboard in OSX is a waste of space and time. Never used it & have no use for it. I usually disable it like this.
#disable dashboard
defaults write com.apple.dashboard mcx-disabled -boolean YES
# must restart dock before it takes effect
killall dock
@maciakl
maciakl / gist:4571322
Last active January 19, 2024 21:14
Google Chrome and Firefox use the Ctrl+K shortcut to initiate search. The equivalent Cmd+K version is missing from OSX release of Chrome. Here is how to add it back.

Enabling Cmd+K in Chrome for OSX

  1. Go to System Preferences.
  2. Click on Keyboard
  3. Go to Keyboard Shortcuts tab
  4. Select application shortcuts in the the left pane
  5. Click the plus sign on the right side under the left pane
  6. Select Google Chrome from the Application dropdown
  7. Type in: "Search the Web..."
@maciakl
maciakl / haversine.php
Last active March 1, 2017 03:35
Haversine formula for finding all the rows in your database which are within N miles from given coordinates. SQL and PHP implementation below. http://en.wikipedia.org/wiki/Haversine_formula
$lat = 0; // some latitude
$lng = 0; // some longitude
$dst = 100; // some distance in miles
// get the contents of the file in the gist below
$sql = file_get_contents('haversine.sql')
// prepare PDO query
$statement = $db->prepare($sql);
@maciakl
maciakl / autoexec.cfg
Created February 2, 2013 01:21
Auto-Deny in DOTA2. Lets you deny creeps and structures with right clicks instead of the [A, then Right Click] combo.
; DOTA2 CONFIG FILE
;;;;;;;;;;;;;;;;;;;;
; Put this file in: C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\dota\cfg\
; Auto-deny on right click (no need to hit A to target friendly unit to deny)
dota_force_right_click_attack 1
@maciakl
maciakl / DOSKEYCONF
Created February 2, 2013 01:40
When you run GruntJS 0.3.x on Windows using the "grunt" command it will attempt to execute the grunt.js config file in the same directory because *.js files are valid windows scripting files. To fix this you need to set an alias for your shell using DOSKEY command. Put the DOSKEYCONF in your %USERPROFILE% directory, then run doskey.reg to set it…
grunt=grunt.cmd $*