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
for ip in $(gseq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo "192.168.1.$ip UP" || : ; 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
var object = {}; | |
function fn(){ | |
return this; | |
} | |
assert( fn() == this, "The context is the global object." ); | |
assert( fn.call(object) == object, "The context is changed to a specific object." ); |
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
<?php | |
class vBulletinUser{ | |
public static function login($username, $remember_me = false){ | |
chdir(VB_ROOT_PATH); | |
require_once('./global.php'); | |
require_once(DIR . '/includes/functions_login.php'); | |
global $vbulletin,$vbphrase; | |
$remember_me = $remember_me ? true : false; //force to true or false value | |
$vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, | |
username, password, salt FROM ".TABLE_PREFIX."user WHERE username = '". |
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
<?php | |
$foo = array(1, 2, 3); | |
foreach($foo as &$bar) { | |
$bar *= $bar; | |
} | |
foreach($foo as $bar){ | |
echo "The square is ", $bar, "\n"; | |
} |
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
<?php | |
error_reporting(E_ALL); | |
ini_set('display_errors', true); | |
class Test { | |
private static $_inst = array(); | |
public static function & __callStatic ($name, $args) { | |
if (!isset(self::$_inst[$name])){ | |
echo "Created \n"; | |
self::$_inst[$name] = (object) "test"; |
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
; f(n) = n, n < 3 | |
; = f(n-1) + 2f(n-2) + 3f(n-3), n >= 3 | |
(define (f-iter n) | |
(fp 2 1 0 n 3)) | |
(define (fp a b c n i) | |
(if (= n i) | |
(+ a (* 2 b) (* 3 c)) | |
(fp (+ a (* 2 b) (* 3 c)) | |
a |
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
// second_largest (array of numbers) | |
// returns 2nd largest number in array | |
function second_largest(numbers) { | |
if(numbers.length < 2){ | |
return numbers[0]; | |
} | |
var n, | |
first_largest = numbers[0], | |
second_largest = numbers[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
#!/usr/bin/env zsh | |
for i in {0..12}; do | |
if [[ $i -lt 10 ]]; then | |
wget http://nltk.googlecode.com/svn/trunk/doc/book/ch0$i.html | |
else | |
wget http://nltk.googlecode.com/svn/trunk/doc/book/ch$i.html | |
fi | |
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
#require 'awesome_print' | |
require 'json' | |
module OMGWidgets ; end | |
module OMGWidgets::ActivityPartition | |
class DirCounter | |
attr_accessor :parent, :name, :hits, :children, :files | |
def initialize(parent=nil) | |
@hits = 0 |
OlderNewer