Skip to content

Instantly share code, notes, and snippets.

@ifnull
ifnull / gist:6456589
Last active December 22, 2015 10:09
Git Cheatsheet

Git Cheatsheet

Current commit hash
git log -1 --format="%H"

Current tag
git describe --always --tag --abbrev=0

Current branch
git describe --contains --all HEAD

@ifnull
ifnull / gist:6555675
Last active December 23, 2015 00:49
Factory Restore and upgraded Dell computer that is missing the Dell Factory Image Restore option.
  • Press F8 repeatedly after reboot until the boot menu is shown.
  • Select Repair Your Computer
  • Click Next and logon to the administrator account in the computer
  • Click Command Prompt
  • Enter the following in the command prompt:
path d:\windows;d:\windows\system32  
d:  
cdtools  
pcrestore 
@ifnull
ifnull / gist:6678440
Created September 23, 2013 23:32
Disk usage with max depth
du --max-depth=1 -x -h /
@ifnull
ifnull / gist:6678480
Created September 23, 2013 23:37
List packages by size. Find large YUM/RPM packages.
rpm -qa --queryformat '%{SIZE} %{NAME} %{VENDOR}\n' | sort -n
@ifnull
ifnull / gist:6691390
Created September 24, 2013 21:17
Zero out a directory of images by replacing with 1x1 image
for f in /usr/share/backgrounds/*.png
do
curl http://placehold.it/1.png -o $f
done
@ifnull
ifnull / gist:6773845
Created October 1, 2013 04:26
Slow Carb Diet Foods

Allowed

Proteins

Notes: All organic with no hormones or antibiotics

  • 1 or 2 eggs with egg whites
  • Chicken (breast/thigh)
  • Beef
  • Fish (Tilapia, Halibut, Salmon)
@ifnull
ifnull / 0_reuse_code.js
Created October 5, 2013 00:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ifnull
ifnull / get-list-of-functions.js
Created October 26, 2013 01:56
List all functions on a page.
var functionNames = [];
for (var f in window) if (window.hasOwnProperty(f) && typeof window[f] === 'function')
{
functionNames.push(f);
}
console.log(functionNames);
@ifnull
ifnull / new_gist_file.sh
Created November 14, 2013 06:50
Get highest memory httpd process
ps axo rss,cmd --sort -rss | grep httpd | head --lines 1 | awk '{print $1}'
@ifnull
ifnull / new_gist_file
Created November 17, 2013 21:11
Get URLs from sitemap.xml
curl -ks http://ec2-50-17-173-58.compute-1.amazonaws.com/sitemap.xml | xpath '/urlset/url/loc/text()' 2>/dev/null | sed -E 's~http(s)?:~/\'$'\nhttp\1:~g' | grep -vE '^\s*$ ' > urls.txt