View export.sh
aws --profile production cognito-idp list-users --user-pool-id us-west-2_XXXXXXXXX --output table > ~/users.txt
View stats.sh
git ls-files | xargs wc -l
git ls-files | xargs cat | wc -l
git ls-files | xargs -n1 git blame --line-porcelain | sed -n 's/^author //p' | sort -f | uniq -ic | sort -nr
git log --shortstat --author="Your Name" | grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6; delta+=$4-$6; ratio=deleted/inserted} END {printf "Commit stats:\n- Files changed (total).. %s\n- Lines added (total).... %s\n- Lines deleted (total).. %s\n- Total lines (delta).... %s\n- Add./Del. ratio (1:n).. 1 : %s\n", files, inserted, deleted, delta, ratio }' -
View scrollintoview.js
var inView = false;
function isScrolledIntoView(elem)
{
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $(elem).offset().top;
var elemBottom = elemTop + $(elem).height();
View angular-promises.js
$scope.getProjectList('projects/').then(function(success) {
var promises = [];
angular.forEach($scope.projects, function(project) {
promises.push($scope.getProjectTasks(project)); // async call here
});
$q.all(promises).then(function(success) {
console.log(success);
}, function(error) {
View redirect.html
<meta http-equiv="refresh" content="0; url=http://yousite.com/blog/2013/10/21/my-post/">
<link rel="canonical" href="http://yousite.com/blog/2013/10/21/my-post/" />
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
View ssl.sh
openssl req -newkey rsa:2048 -new -nodes -keyout key.pem -out csr.pem
###################
openssl genrsa 1024 > host.key
chmod 400 host.key
openssl req -new -x509 -nodes -sha1 -days 365 -key host.key -out host.cert
View json.py
import json
from datetime import date, datetime
def json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, (datetime, date)):
serial = obj.isoformat()
return serial
raise TypeError ("Type %s not serializable" % type(obj))
View wipe.sh
diskUtil randomDisk 2 /dev/disk4
View ping.sh
ping -b -c 2 255.255.255.255 > /dev/null 2>&1; arp -an