Skip to content

Instantly share code, notes, and snippets.

@isS
isS / unserialize.php
Created March 16, 2023 08:49 — forked from phred/unserialize.php
Simple reliable and non-regex method to unserialize PHP session data
//
// This is the result of about an hour's delving into PHP's hairy-ass serialization internals.
// PHP provides a session_decode function, however, it's only useful for setting the contents of
// $_SESSION. Say, for instance, you want to decode the session strings that PHP stores in its
// session files -- session_decode gets you nowhere.
//
// There are a bunch of nasty little solutions on the manual page[1] that use pretty hairy regular
// expressions to get the job done, but I found a simple way to use PHP's unserialize and recurse
// through the string extracting all of the serialized bits along the way.
//
@isS
isS / pan.baidu.com.py
Created December 30, 2015 02:57 — forked from PeterDing/pan.baidu.com.py
百度云、百度网盘,递归下载自己的文件或分享的文件 -- keywords: pan.baidu.com, login, recursively, download -- # 移到仓库 https://github.com/PeterDing/iScript
#!/usr/bin/env python2
# vim: set fileencoding=utf8
import os
import sys
import requests
import urllib
import json
import re
import time
@isS
isS / top.js
Last active December 11, 2015 04:28
页面滚动后出现返回到顶部的按钮。位置居于底部50px。 "</div>").css({position: b.cssfixedsupport ? "fixed" : "absolute",bottom: b.controlattrs.offsety +"%",left: y+"px",opacity: 0,cursor: "pointer"}).attr({title: "返回顶部"}).click(function() { //这里的bottom 设置离页面底部35%距离, 默认离底部的单位为px。
$(document).ready(function() {
var c = {setting: {startline: 20,scrollto: 0,scrollduration: 300,fadeduration: [500, 100]},controlHTML: '<img src="http://www.uloci.com.cn/images/top_btn.png" style="width:70px; height:70px" />',controlattrs: {offsetx: 0,offsety: 35},anchorkeyword: "#top",state: {isvisible: !1,shouldvisible: !1},scrollup: function() {
this.cssfixedsupport || this.$control.css({opacity: 0});
var a = isNaN(this.setting.scrollto) ? this.setting.scrollto : parseInt(this.setting.scrollto), a = "string" == typeof a && 1 == jQuery("#" + a).length ? jQuery("#" + a).offset().top : 0;
this.$body.animate({scrollTop: a}, this.setting.scrollduration)
},keepfixed: function() {
var a = jQuery(window), b = (a.scrollLeft() + a.width()) - 85, a = a.scrollTop() + a.height() - this.$control.height() - this.controlattrs.offsety;
this.$control.css({left: b + "px",top: a + "px"})
},togglecontrol: function() {
var a = jQuery(win
<?php
// vim: set et sw=4 ts=4 sts=4 fdm=marker ff=unix fenc=utf8
* UniqueID 生成唯一的id
可用于在分布式服务器下生成唯一的id。
* @author shaojianyi <issuoow@gmail.com>
*/
class UniqueID {
public $u1;
@isS
isS / 12306AutoSubmit.user.js
Created September 6, 2012 09:41 — forked from kevintop/12306AutoSubmit.user.js
12306 Auto Submit
/*
12306 Auto Submit => A javascript snippet to help you auto submit.
Copyright (C) 2011 Kevintop
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes 12306.user.js
@isS
isS / 12306AutoSubmit.user.js
Created September 6, 2012 09:41 — forked from kevintop/12306AutoSubmit.user.js
12306 Auto Submit
/*
12306 Auto Submit => A javascript snippet to help you auto submit.
Copyright (C) 2011 Kevintop
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes 12306.user.js
@isS
isS / .vimrc
Created September 1, 2012 18:05
.vimrc MacVim配置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => 文件编码选项
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set encoding=utf-8
set fileencoding=chinese
set fileencodings=ucs-bom,utf-8,chinese,gb18030,gbk,gb2312,cp936,prc,taiwan,latin-1
"set fileencoding=utf-8
set encoding=utf8
set ffs=unix,dos,mac "设置换行符格式
set ff=unix "设置缓冲区换行符格式
@isS
isS / gist:3245643
Created August 3, 2012 08:04 — forked from fxsjy/gist:3244607
Simple Memcached server in Javascript with 100 lines of code
/* Simple Memcached in Javascript
* @Author: Sun, Junyi
* @Email: ccnusjy@gmail.com
* @Date: 2012-8-3
*/
var net = require('net');
var store = {}
function handle_header(header,crlf_len){
var tup = header.split(" ")
@isS
isS / hl.js
Created October 22, 2011 17:11
Highlight search engine keywords for the landing page
/**
* 关键词高亮动态解析
*
* @author Saturn
* @since 1.0.0
* @return void
*/
var Highlighter={
highlight:
function(b,a){