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
/* | |
@fliptopbox | |
LZW Compression/Decompression for Strings | |
Implementation of LZW algorithms from: | |
http://rosettacode.org/wiki/LZW_compression#JavaScript | |
Usage: | |
var a = 'a very very long string to be squashed'; | |
var b = a.compress(); // 'a veryāăąlong striċ to bečquashed' |
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 | |
function weekNumberToDate($year, $week, $wday = 1) { | |
// http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday | |
$correction = (int)gmdate('w', gmmktime(0, 0, 0, 1, 4, (int)$year)) + 3; | |
$yday = (int)$week * 7 + (int)$wday - $correction; | |
$time = gmmktime(0, 0, 0, 1, $yday, (int)$year); | |
return array((int)gmdate('Y', $time), (int)gmdate('n', $time), (int)gmdate('j', $time)); | |
} | |
var_dump(weekNumberToDate(2008, 39, 6)); |
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 | |
# WebSocket shell, start & browse to http://<Host>:6655/ | |
# Requires bash 4.x, openssl. | |
# Author: [email protected] (which isn't me, apk) | |
coproc d { nc -l -p 6656 -q 0; } | |
nc -l -p 6655 -q 1 > /dev/null <<-ENDOFPAGE | |
HTTP/1.1 200 OK | |
<html><head><script language="javascript"> | |
var url = location.hostname + ':' + (parseInt(location.port) + 1); |
NewerOlder