Skip to content

Instantly share code, notes, and snippets.

View patricknelson's full-sized avatar
:shipit:
Pushing 1's and 0's.

Patrick Nelson patricknelson

:shipit:
Pushing 1's and 0's.
View GitHub Profile
@aras-p
aras-p / mvp.js
Created June 6, 2011 17:30
UNITY_MATRIX_MVP et al equivalents in script
// world, view, projection matrices
var world = obj.transform.localToWorldMatrix;
var view = cam.worldToCameraMatrix;
var proj = cam.projectionMatrix;
// the actual projection matrix used in shaders
// is actually massaged a bit to work across all platforms
// (different Z value ranges etc.)
var gpuProj = GL.GetGPUProjectionMatrix (proj, false);
var gpuMV = view * world; // UNITY_MATRIX_MV
@marcedwards
marcedwards / high-dpi-media.css
Last active November 19, 2023 12:56
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@dmytro
dmytro / ssh-multi.sh
Created October 31, 2012 03:46
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi
# D.Kovalov
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# a script to ssh multiple servers over multiple tmux panes
starttmux() {
if [ -z "$HOSTS" ]; then
@gsomoza
gsomoza / .bashrc
Created January 17, 2013 16:50
SSH Agent in Windows (Git Bash / MinGW)
#!bash.exe
export SSH_AUTH_SOCK=/tmp/.ssh-socket
echo ;
echo Starting connection with ssh-agent...
ssh-add -l 2>&1 >/dev/null
if [ $? = 2 ]; then
rm -f /tmp/.ssh-script /tmp/.ssh-agent-pid /tmp/.ssh-socket
# Exit status 2 means couldn't connect to ssh-agent; start one now
echo Creating new ssh-agent...
ssh-agent -a $SSH_AUTH_SOCK > /tmp/.ssh-script
@wolever
wolever / profile
Created September 11, 2013 15:41
My very fast Bash prompt, which shows git branch, virtualenv, and background jobs
# prompt examples:
# [3 jobs master virtualenv] ~/code/myproject/foo
# [1 job my-branch virtualenv] ~/code/bar/
# [virtualenv] ~/code/
# ~
# Very, very fast, only requiring a couple of fork()s (and no forking at all to determine the current git branch)
if [[ "$USER" == "root" ]]
then
export PS1="\e[1;31m\]\u \[\e[1;33m\]\w\[\e[0m\] ";
@niksumeiko
niksumeiko / git.migrate
Last active July 19, 2024 21:32
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@maxim
maxim / task.yml
Created June 12, 2014 11:09
Adding github to known_hosts with ansible
- name: ensure github.com is a known host
lineinfile:
dest: /root/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}"
regexp: "^github\\.com"
@brendanmckeown
brendanmckeown / equal-grid-columns.scss
Last active August 29, 2015 14:19
Sass mixin for equal multi-column layout. Include in the parent selector and specify the number of columns, the size of the gap between columns, and the direct children selector. Depends on a clearfix solution for the parent, and assumes you have applied "box-sizing: border-box" at a global level. Example: http://jsfiddle.net/brendanmckeown/gzr8…
@mixin equal-grid-columns($columns, $gap, $el) {
@include clearfix;
> #{$el} {
float: left;
width: (100% / $columns);
$halfGap: ($gap / 2);
padding: 0 $halfGap;
margin-top: $gap;
@for $i from 1 through $columns {
@tkon99
tkon99 / name.js
Last active April 19, 2024 14:38
Random Name Generator for Javascript
/*
(c) by Thomas Konings
Random Name Generator for Javascript
*/
function capFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function getRandomInt(min, max) {