Skip to content

Instantly share code, notes, and snippets.

View xdtianyu's full-sized avatar
🏠
Working from home

tianyu xdtianyu

🏠
Working from home
View GitHub Profile
@xdtianyu
xdtianyu / uwsgi
Created March 18, 2015 07:13
uwsgi nginx flask deploy
$apt-get install nginx python-dev libpcre3 libpcre3-dev
$pip install uwsgi
$cat uwsgi.ini
[uwsgi]
socket = /tmp/flask.sock
chmod-sock = 666
module = server
callable = app
enable-threads = true
@xdtianyu
xdtianyu / xxx.php
Last active December 31, 2018 11:45
<?php
if (rand()%5==0) {
echo "1111";
} else {
echo "0000";
}
?>
#!/usr/bin/env python
"""Replacement for htpasswd"""
# Original author: Eli Carter
import os
import sys
import random
from optparse import OptionParser
# We need a crypt module, but Windows doesn't have one by default. Try to find
@xdtianyu
xdtianyu / GB2312-UTF8.sh
Created April 13, 2015 02:54
Usage: GB2312-UTF8.sh [directory name]
#!/bin/bash
#Usage: GB2312-UTF8.sh [directory name]
DIR=$1
cd $DIR
mkdir utf8
for file in *.txt ; do
<?php
// Pear Mail Library
require_once "Mail.php";
$event = $_POST['event'];
$name = $_POST['name'];
$time = date('Y-m-d H:i:s');
$from = '<[email protected]>';
$to = $_POST['email'];
package org.xdty.buttontest;
import android.test.ActivityInstrumentationTestCase2;
/**
* Created by ty on 15-6-26.
*/
public class ActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
public ActivityTest() {
super(MainActivity.class);
server {
listen 80 default;
listen 443 default;
server_name _;
ssl_certificate certs/default.crt;
ssl_certificate_key certs/default.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
@xdtianyu
xdtianyu / reflect.py
Created May 27, 2016 09:40 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@xdtianyu
xdtianyu / README.md
Created June 23, 2016 07:02 — forked from ringe/README.md
KVM QCOW2 Live backup

Live backup of KVM virtual machines

This script will let you make backups of live VMs running on KVM, using libvirt.

The backup job will suspend the VM for the time it takes to copy the RAM to disk.

Credits: Luca Lazzeroni

I've made some minor adjustments.

AUTHOR=MAKE_FOR_FUN
.DEFAULT:
@echo Make $@ great again!
install:
@echo Make Makefile great again!
clean:
@echo "America is great."