Ctrl + a – go to the start of the command line
Ctrl + e – go to the end of the command line
Ctrl + k – delete from cursor to the end of the command line
Ctrl + u – delete from cursor to the start of the command line
Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
# Put this in your ~/.gitconfig or ~/.config/git/config | |
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName> | |
[user] | |
name = Your Full Name | |
email = [email protected] | |
[color] | |
# Enable colors in color-supporting terminals | |
ui = auto | |
[alias] | |
# List available aliases |
<?php | |
/** | |
* Case in-sensitive array_search() with partial matches | |
* | |
* @param string $needle The string to search for. | |
* @param array $haystack The array to search in. | |
* | |
* @author Bran van der Meer <[email protected]> | |
* @since 29-01-2010 | |
*/ |
#!/usr/bin/env bash | |
# Use this one-liner to produce a JSON literal from the Git log: | |
git log \ | |
--pretty=format:'{%n "commit": "%H",%n "author": "%aN <%aE>",%n "date": "%ad",%n "message": "%f"%n},' \ | |
$@ | \ | |
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \ | |
perl -pe 's/},]/}]/' |
In a similar vein to git reset --hard feature/weavils
you can just overwrite untracked working files (typically left over from branch experiments) which are part of the remote branch you're pulling like this:
git reset --hard origin/feature/weavils
Normally, if you tried git checkout feature/weavils
you'd get warnings like untracked working tree files would be overwritten by merge
, so hit them with the --hard
hammer instead.
(Found via https://stackoverflow.com/q/17404316/391826 and one of the answers: https://stackoverflow.com/a/36824493/391826)
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
<?php | |
/** | |
* Theme_menu_tree doesn't provide any context information | |
* THIS SUCKS | |
* But you can use hook_block_view_alter to change the theme wrapper | |
* OUF! | |
*/ | |
function MYTHEME_menu_tree(&$variables) { |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
#!/bin/sh | |
ProgName=$(basename $0) | |
sub_help(){ | |
echo "Usage: $ProgName <subcommand> [options]\n" | |
echo "Subcommands:" | |
echo " bar Do bar" | |
echo " baz Run baz" | |
echo "" |