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
gradient_percentage = 0.10 | |
# Split into RGB | |
red = backgroundcolor[0,2].hex | |
green = backgroundcolor[2,2].hex | |
blue = backgroundcolor[4,2].hex | |
# Add percentage (could subtract if you want to darker) | |
red += (red * gradient_percentage).to_i | |
green += (green * gradient_percentage).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
#! /bin/sh | |
## | |
# Generated by Chef | |
# <%= Time.now %> | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog |
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
var queryStrings = window.location.search.substring(1).split("&") | |
var params = {}; | |
for (var i = 0; i < queryStrings.length; i++) { | |
var splitParam = queryStrings[i].split("="); | |
if (splitParam.length > 1) { | |
var key = splitParam[0]; | |
var val = splitParam[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
evil_host=gouki.teve.inc | |
pts=$(w | grep $evil_host | awk '{ print $2 }') | |
skill -KILL -t $pts |
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 | |
host=$1 | |
response_code=$(curl -sL -w "%{http_code}" --connect-timeout 10 --digest -X PUT $host -o /dev/null) | |
case $response_code in | |
[2][0-9][0-9]) echo "OK"; exit 0;; | |
*) echo "Critical $response_code"; exit 3;; | |
esac |
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
volume_groups=$(vgdisplay | grep "VG Name" | awk '{print $3}') | |
for g in $volume_groups; do | |
vgremove --force $g | |
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
PING 192.168.0.1 (192.168.0.1): 56 data bytes | |
64 bytes from 192.168.0.1: icmp_seq=0 ttl=64 time=323.204 ms | |
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=136.842 ms | |
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=238.083 ms | |
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=61.807 ms | |
64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=900.285 ms | |
Request timeout for icmp_seq 5 | |
Request timeout for icmp_seq 6 | |
64 bytes from 192.168.0.1: icmp_seq=5 ttl=64 time=2504.300 ms | |
64 bytes from 192.168.0.1: icmp_seq=7 ttl=64 time=903.107 ms |
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
require 'open-uri' | |
Benchmark.measure { | |
URI.parse('http://yahoo.com').read | |
URI.parse('http://yahoo.com').read | |
URI.parse('http://yahoo.com').read | |
} | |
# => 0.080000 0.020000 0.100000 ( 6.717970) |
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
require 'celluloid' | |
require 'open-uri' | |
class Fetcher | |
include Celluloid | |
def fetch(url) | |
URI.parse(url).read | |
end | |
end |
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
require 'sinatra/base' | |
require 'dm-core' | |
require 'dm-migrations' | |
require 'dm-serializer/to_json' | |
module BestAppEver | |
class App < Sinatra::Base | |
configure :development do |