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
#!/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 = '<YOUR_NAME@gmail.com>';
$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."
[Unit]
Description=dhclient for sending DUID IPv6
Wants=network.target
Before=network.target
[Service]
Type=forking
ExecStart=/sbin/dhclient -cf /etc/dhcp/dhclient6.conf -pf /var/run/dhclient6.ens3.pid -6 -D LL -N -v ens3
PIDFile=/var/run/dhclient6.ens3.pid
ExecReload=/bin/kill -HUP $MAINPID
#!/bin/bash
DIR=/opt/install
MYSQL_USER=root
MYSQL_PASS=123456
# prepare repo list
cd $DIR
tar xf repo.tar.gz