This file contains 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/python | |
import urllib2, urllib, socket | |
username = 'USERNAME' | |
password = 'PASSWORD' | |
ip = socket.gethostbyname(socket.gethostname()) | |
gateway = ip.split('.') | |
gateway[3]='1' | |
gatewayip = gateway[0:4] | |
gate_ip = ".".join(gatewayip) | |
gatesip = "http://",gate_ip,"/login.pl" |
This file contains 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/env php | |
<?php | |
$host = "http://servly.com/rrd/update"; | |
error_reporting(E_NONE); | |
echo "\n"; | |
$mon = array(); | |
sleep(5); // so it reads properly | |
/* CPU Usage */ | |
$cpu = `sar 1 | awk 'END {print \$NF}'`; | |
$mon[cpu][free] = $cpu; |
This file contains 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
Make this a file, executable, add this to cron: | |
*/5 * * * * root /path/to/script; | |
Requirements: sysstat package on CentOS (yum install sysstat) || or just the sar command | |
#!/bin/env php | |
<?php | |
$host = "http://servly.com/rrd/update"; | |
error_reporting(E_NONE); | |
echo "\n"; |
This file contains 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
class SignupController < ApplicationController | |
layout "signup" | |
def index | |
require "digest" | |
if request.post? | |
@user = User.create(:email => params[:signup][:email], :username => params[:signup][:username], :password => Digest::SHA1.hexdigest(params[:signup][:password])) | |
end | |
end | |
end |
This file contains 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
/* | |
Copyright Josh Rendek 2009 | |
http://bluescripts.net/ | |
Not liable for anything | |
1m6sec to process a 1.8GB File | |
*/ | |
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <algorithm> |
This file contains 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
class Canonical | |
def initialize(eq) | |
@eq = eq.split('+') | |
@new_eq = [] | |
end | |
def binary_to_decimal(x) | |
y = 1 | |
z = 0 |
This file contains 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 | |
#script that will download images off of 4 chan | |
require 'rubygems' | |
require 'active_record' | |
require 'hpricot' | |
require 'rest-open-uri' | |
require 'net/http' |
This file contains 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
def self.get_search_results(query) | |
# API request variables | |
endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1'; # URL to call | |
version = '1.0.0'; # API version supported by your application | |
appid = 'YOUR APP ID'; # Replace with your own AppID | |
globalid = 'EBAY-US'; # Global ID of the eBay site you want to search (e.g., EBAY-DE) | |
safequery = URI.encode(query); # Make the query URL-friendly | |
# Construct the findItemsByKeywords HTTP GET call | |
apicall = "#{endpoint}?"; |
This file contains 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
def self.search(term, per_page, page, subdomain_id) | |
conditions, conditional = Array.new, Array.new | |
# made prettier by an array and a join | |
self.column_names.collect { |c| c != "subdomain" ? conditional << "#{c} LIKE '%%%s%%'" : "" } | |
# wrap around SQL logic for making sure search only returns results pertinent to domain | |
conditions.push("(" + conditional.join(' OR ') + ") AND subdomain = '#{subdomain_id}'") | |
# push the search term into the conditions -- replacing the %%s%% |
This file contains 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
def get_object | |
type = params['event_id'] ? 'event' : 'person' | |
value = type.classify.constantize.find(params[:"#{type}_id"]) | |
name = '@' + type | |
instance_variable_set(name , value) | |
end |
OlderNewer