Skip to content

Instantly share code, notes, and snippets.

Stephen sdpfoue

Block or report user

Report or block sdpfoue

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sdpfoue
sdpfoue / pre-receive
Last active Apr 29, 2016 — forked from proofek/pre-receive
two git pre-receive for php
View pre-receive
#!/usr/bin/php
<?php
echo "\nRunning php linter...\n";
$params = explode(' ', file_get_contents('php://stdin'));
$ref = trim($params[1]);
$diff = array();
$return = 0;
@sdpfoue
sdpfoue / rename.php
Last active Aug 29, 2015
random add num prefix to file
View rename.php
<?php
$files = scandir('.');
shuffle($files);
$i = 1;
foreach($files as $file){
if(preg_match('/^\./', $file)){
continue;
}
if(!preg_match('/(mp3|wav)$/', $file)){
continue;
@sdpfoue
sdpfoue / gist:be73da209b6e8b208d41
Last active Aug 29, 2015
小木屋游戏存档
View gist:be73da209b6e8b208d41
eyJ2ZXJzaW9uIjoxLjMsImZlYXR1cmVzIjp7ImxvY2F0aW9uIjp7InJvb20iOnRydWUsIm91dHNpZGUiOnRydWUsIndvcmxkIjp0cnVlLCJzcGFjZVNoaXAiOnRydWV9fSwic3RvcmVzIjp7IuacqOWktCI6ODMyOTgsIuiCiSI6OTkwNTAsIuavm+eariI6Mzk0Miwi6K+x6aW1IjoyNDIsIueJmem9vyI6MTgwMTUsIuearumdqSI6MzQwNCwi6IWM6IKJIjo0NDU5LCLps57niYciOjU2MDAwLCLluIPljLkiOjkwLCLmiqTouqvnrKYiOjIsIue9l+ebmCI6MSwi5rC06KKLIjoxMDAsIumqqOaeqiI6Miwi54Gr54KsIjo5OSwi5peF6KGM5YyFIjoxLCLnmq7nlLIiOjEsIuWtkOW8uSI6OTk5OTk0OSwi5Yy755aX6I2v5YmCIjo5OTg4LCLpk4EiOjE1Mzk5LCLnhaQiOjIxNDQsIumSoiI6MjIxNjMwLCLmsLTmobYiOjEwMCwi6LSn6L2mIjoxMCwi6ZOB55SyIjoxLCLpk4HliZEiOjEsIuWkp+i0p+i9piI6MTAwMCwi6ZO+55CDIjowLCLpkqLnlLIiOjEsIumSouWJkSI6MSwi5aSW5pif5ZCI6YeRIjoxNTk2NCwi5rC0566xIjoxMDAwLCLmraXmnqoiOjMwMSwi6ZWt5bCE5p6qIjoxMDAwLCLnh4PmlpnnlLXmsaAiOjk1MCwi5omL6Zu3Ijo5OTgyLCLnoavno7oiOjk1MH0sImNoYXJhY3RlciI6eyJwdW5jaGVzIjoxMjQsInN0YXJ2ZWQiOjMsInBlcmtzIjp7IumZjem+meWNgeWFq+aOjCI6dHJ1ZSwi6YCa6IeC5ouzIjp0cnVlLCLlh4zms6Llvq7mraUiOnRydWV9LCJkZWh5ZHJhdGVkIjoyfSwiaW5jb21lIjp7ImdhdGhlcmVyIjp7ImRlbGF5IjoxMCwic3RvcmVzIjp7
View hb-test.py
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
@sdpfoue
sdpfoue / max-profit-of-an-interval.php
Created Dec 5, 2013
get the max profit of a certain interval
View max-profit-of-an-interval.php
<?php
$data = array();
for($i = 0; $i <= 50; $i++){
if(0 == $i){
$data[] = mt_rand(1,20);
}else{
$data[] = max(0, mt_rand($data[$i-1] - 1, $data[$i-1] +1));
}
@sdpfoue
sdpfoue / multi_db_query.php
Created Sep 24, 2013
多组db query轮查,给出统一结果
View multi_db_query.php
<?php
$db_conf = array(
array(
'host' => '1',
'port' => '',
'db' => '1',
'user' => '1',
'pwd' => '1',
),
array(
View haml_vs_erb_vs_erubis.rb
# encoding: utf-8
require 'rubygems'
require 'haml'
require 'erb'
require 'erubis'
notes = []
20.times { notes << {:title => "标题标题", :content => "内容,内容"} }
obj = {
@sdpfoue
sdpfoue / GoogleAuthenticator.php
Created Mar 10, 2013
google 2 步验证 PHP 算法
View GoogleAuthenticator.php
<?php
// https://github.com/fuchaoqun/colaphp/blob/2.0/Cola/Ext/GoogleAuthenticator.php
class Cola_Ext_GoogleAuthenticator
{
public static $ttl = 30;
public static $limit = 6;
// Lookup needed for Base32 encoding
private static $map = array(
@sdpfoue
sdpfoue / DC_encode.java
Last active Dec 13, 2015
字符串编码,解码使用dc -e密文P
View DC_encode.java
//decode result with dc command like dc -e0000P
import java.math.BigInteger;
public class DC_encode {
public static void main(String[] args) {
String a="";
String b=args[0]+"\n";
for(int i=0;i<b.length();i++){
if(Integer.toBinaryString(b.charAt(i)).length()==8)
a=a+Integer.toBinaryString(b.charAt(i));
else{
@sdpfoue
sdpfoue / Sudoku.java
Last active Dec 13, 2015
暴力解数独 force brute to solve a Sudoku
View Sudoku.java
//数独
import java.util.*;
public class Sudoku{
private static int steps=0;
private static int sudo[][]=new int[][]{
{0,0,0,0,0,9,6,0,0},
{0,0,7,0,0,1,0,0,0},
{0,4,0,0,0,0,0,0,0},
{0,0,0,0,4,0,0,0,0},
You can’t perform that action at this time.