Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

会有猫的 gonejack

I may be slow to respond.
View GitHub Profile
gonejack / book list
Last active March 9, 2023 06:42
View book list
Calculus An Intuitive and Physical Approach(Second Edition).epub
Working Memory and Neurodevelopmental disorders - Tracy Packiam Alloway.epub
Schaum's Outline of College Physics - Frederick Bueche.epub
gonejack / $http_response_header_parser.php
Last active August 29, 2015 14:18
parse $http_response_header
View $http_response_header_parser.php
* Parse a set of HTTP headers
* @param array The php headers to be parsed
* @param [string] The name of the header to be retrieved
* @return A header value if a header is passed;
* An array with all the headers otherwise
function parseHeaders(array $headers, $header = null) {
gonejack / zip.lib.php
Last active July 12, 2016 15:07
Create Zip Archive for download in memory(without using file system)
View zip.lib.php
sometimes we don't want to make any usage to the hardisk, when we just want to grab something from remote server, and make a Zip archive for download, and the offical php ZipArchive module don't support this till now, so here is a class to make this(from phpMyAdmin library).
Here is sample usage:
//create the zip
$zip = new zipfile();
//add files to the zip, passing file contents, not actual files
gonejack / define unicode string in PHP
Last active August 29, 2015 14:25
not like Python and JavaScript, PHP don't directly support embedding unicode value like "\uXXXX" into strings, so use the way below.
View define unicode string in PHP
echo json_decode('"\u30FB"');
gonejack / repr_equivalent_for_php_strings.php
Last active August 29, 2015 14:25
var_export just working for array, we need a repr equivalence for string
View repr_equivalent_for_php_strings.php
* Created by PhpStorm.
* User: Youi
* Date: 7/25/2015
* Time: 8:44 PM
$s = "\x21\xff thing\n\t\\字";
gonejack /
Last active February 13, 2023 17:44
Colemak keymap for DOSBox, put this file to %LOCALAPPDATA%\DOSBox
hand_shutdown "key 290 mod1"
hand_capmouse "key 291 mod1"
hand_fullscr "key 13 mod2"
hand_pause "key 19 mod2"
hand_mapper "key 282 mod1"
hand_speedlock "key 293 mod2"
hand_recwave "key 287 mod1"
hand_caprawmidi "key 289 mod1 mod2"
hand_scrshot "key 286 mod1"
hand_video "key 286 mod1 mod2"
View JavaScript falsy values
''(empty string)
View JavaScript handys
x+'' //convert to string
+x //convert to number
!!x //convert to boolean
//generate short random string
//generate random ports
((Math.random() + 1) / 2 * 65535).toString().slice(0, 5)
gonejack / get_redirect_location.php
Last active October 31, 2015 14:22
PHP get URL redirect location
View get_redirect_location.php
function get_redirect_url($url) {
'http' => array(
#'method' => 'HEAD',
'request_fulluri' => true,
'proxy' => 'tcp://'
View Windows CMD handing Commands
//task killer
taskkill [/s Computer] [/u Domain\User [/p Password]]] [/fi FilterName] [/pid ProcessID]|[/im ImageName] [/f][/t]