This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'grit' | |
begin | |
r = Grit::Repo.new Dir.pwd | |
rescue | |
puts "Did not detect git repository" | |
exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## gpull | |
#!/bin/bash | |
branch=$(git name-rev --name-only HEAD) | |
if [ "$1x" == "x" ]; then | |
echo "git pull origin $branch" | |
git pull origin $branch | |
else | |
echo "git pull $1 origin $branch" | |
git pull $1 origin $branch | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
interval=30 | |
cycles=$((60/$interval*60*2)) | |
date=`date -I` | |
sar -A -o sar.$date $interval $cycles >/dev/null 2>&1 & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in {1..10}; do time /usr/sbin/bonnie++ -f | tee `hostname`.bonnie.$i ; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
curl -k https://raw.github.com/gregs1104/stream-scaling/master/stream-scaling > ./stream-scaling \ | |
&& sh ./stream-scaling |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GB=2 # how much memory in the system | |
SZ=$((2*$GB)) # you want at least 2x memory size | |
dd if=/dev/zero of=bigfile bs=8k count=$((250000 * $SZ)) && sync |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdif -f /var/lib/swap | |
for swapf in {0..3}; do | |
dd if=/dev/zero of=/var/lib/swap/2-$swapf count=4194304 bs=512 | |
mkswap /var/lib/swap/2-$swapf | |
echo "/var/lib/swap/2-$swapf swap swap defaults 0 0" >> /etc/fstab | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true; do | |
date && cat /proc/meminfo | grep Commit | sed "s/[^0-9]*//g" | tr '\n' ' ' \ | |
| awk '{ x=$2/$1; if (x > 1) { printf("Exceeded! %2.2f\n", $2 / $1) } else { printf("OK %2.2f\n", $2 / $1) }}'; | |
sleep 5; | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns huddler.sql.forum-post | |
(:use [huddler.util.sql :as sql] | |
[pidge.sort] | |
[pidge.store.redis])) | |
; site type tid order | |
(def post-key-format "%s-%d-%d-id-asc") | |
(defn map-posts-by-id-desc [thread_id f] | |
(sql/query-map f "SELECT thread_id, id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn display-order-page-sql [ids scores] | |
(sql/with-conn | |
(sql/query (format "WITH display_order AS ( | |
SELECT UNNEST(ARRAY[%s]) AS id, | |
UNNEST(ARRAY[%s]) AS pos | |
) | |
SELECT * FROM display_order | |
JOIN forum_posts ON ( | |
display_order.id = forum_posts.id | |
) |
OlderNewer