apt-get install ruby
wget https://raw.github.com/gist/3606882/ecefcd097bb8ae8bf163c30e643ecdc8f57abd53/md2cre.rb
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 | |
| function get_cpu_usage() { | |
| cpu=`ps auwx|grep "$1"|grep -v 'grep'|tr -s ' ' ' ' | cut -d' ' -f3|awk '{s+=$1}END{print s}' `; | |
| } | |
| function get_mem_usage() { | |
| mem=`ps auwx|grep "$1"|grep -v 'grep'|tr -s ' ' ' ' | cut -d' ' -f4|awk '{s+=$1}END{print s}' `; | |
| } |
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
| u = User.first | |
| p = Page.first | |
| # Only like this does it work | |
| p.user = u | |
| u.pages << p | |
| # this does not work (does not set the user_id in the pages table) | |
| > p.user(u).save | |
| (0.1ms) begin transaction |
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 | |
| app_name="redmine" | |
| pid_file="/var/run/#{app_name}.pid" | |
| user="redmine" | |
| appdir="/home/#{user}/redmine" | |
| LOAD_RVM="source /home/#{user}/.rvm/scripts/rvm" | |
| START_APP="RAILS_ENV=production passenger start -a 127.0.0.1 -p 3002" | |
| STOP_APP="RAILS_ENV=production passenger stop -a 127.0.0.1 -p 3002" |
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 | |
| # Some vars | |
| REPO="https://github.com/hamstar/Braincase.git"; | |
| LREPO="/var/www/test/repo"; | |
| BRANCH="sprint2"; # this could be replaced with ref | |
| BUILDDIR="$LREPO/packages/debian"; | |
| WEBDIR="/var/www/test"; | |
| # Refresh the repo |
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 | |
| hash=$1; | |
| wget "http://i.imgur.com/$hash.png" |
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
| cd /root/build | |
| rm -fr packages/debian/var packages/debian/usr packages/debian/etc | |
| cp -Rf usr etc var -t packages/debian | |
| chmod a+x packages/debian/usr/bin/* | |
| dpkg-deb --build packages/debian |
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 | |
| echo -n "Enter the mysql database name: " | |
| read DB; | |
| echo -n "Enter the mysql user name: " | |
| read USER; | |
| echo -n "Please enter the mysql password: "; | |
| set -v off; |
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 | |
| $threshold = 60 | |
| $external_snapshots = "/media/external/snapshots" | |
| $system_snapshots = "/backup/backintime/AKSCOU01.local/root/1" | |
| # ensure correct drive is mounted | |
| # enforce the threshold | |
| freespace = `df -l|grep /media/external|tr -s ' ' ' '|cut -d' ' -f4`.chomp.to_i |
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
| // ==UserScript== | |
| // @name Git Reference Labels | |
| // @namespace http://gist.github.com/3369304 | |
| // @version 0.2.1 | |
| // @description Shows labels next to issue references in the comments of git issues | |
| // @include https://github.com/*/*/issues/* | |
| // @copyright 2012+, Robert McLeod | |
| // @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
| // ==/UserScript== |