Skip to content

Instantly share code, notes, and snippets.

@xiangjian
xiangjian / gist:0ea31f4e1e1e7847bfd70a882cb5441a
Created November 27, 2020 10:48 — forked from hSATAC/gist:5343225
Http Redirect in Golang
package main
import (
"log"
"net/http"
)
func redirect(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "http://www.google.com", 301)
@xiangjian
xiangjian / install_mono.sh
Created March 3, 2016 00:28 — forked from andreazevedo/install_mono.sh
Install mono on centOS 6.x
$ yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libgdi* libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget
$ cd /usr/local/src
$ wget http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2
$ tar jxf mono-3.2.8.tar.bz2
$ cd mono-3.2.8
@xiangjian
xiangjian / gist:9364368
Created March 5, 2014 09:55
port判断
TCP端口
nc -w 1 127.0.0.1 53 && echo true || echo false
UDP端口:
nc -w 1 -u 127.0.0.1 53 && echo true || echo false
server {
# Redirect yoursite.com to www.yoursite.com
server_name yoursite.com;
rewrite ^(.*) http://www.yoursite.com$1 permanent;
}
server {
# Tell nginx to handle requests for the www.yoursite.com domain
server_name www.yoursite.com;
server {
listen 80 default_server;
server_name demo.xiangjian.info ;
root /srv/www/demo.xiangjian.info/public;
access_log /srv/www/demo.xiangjian.info/log/access.log;
error_log /srv/www/demo.xiangjian.info/log/error.log;
location / {
index index.php;
#!/bin/sh
backuppath="/home/epmds/backup"
user=""
password=""
db=""
redsource=""
# backup mysql
@xiangjian
xiangjian / table space
Created December 13, 2012 06:14
Oracle DBA table space
CREATE USER PCEDM_DM IDENTIFIED BY PDM123
DEFAULT TABLESPACE epdms
TEMPORARY TABLESPACE temp
QUOTA UNLIMITED ON epdms;
GRANT CREATE SESSION to PCEDM_DM;
GRANT CREATE SYNONYM TO PCEDM_DM;
GRANT CREATE PROCEDURE TO PCEDM_DM;
GRANT CREATE TABLE TO PCEDM_DM;
GRANT CREATE VIEW TO PCEDM_DM;
@xiangjian
xiangjian / redis-server
Created January 6, 2012 02:45
redis & webdis init script for ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@xiangjian
xiangjian / wordpressdotcom.rb
Created December 18, 2011 04:00 — forked from yorkxin/wordpressdotcom.rb
Wordpress.com (XML export) to Octopress importer. See http://git.io/PSKCcA for change notes.
# coding: utf-8
# Original File: https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb
# Modified by Yu-Cheng Chuang <[email protected]>
# Licensed under MIT License (same as the original file)
# This version of wordpressdotcom.rb is compatible
# with the real-world Wordpress.com export file, which:
#
# - Makes paragraphs (<p>) and line breaks (<br>)
@xiangjian
xiangjian / website2webapp
Created September 13, 2011 08:19
vim for website to webapp
:args *.aspx */*.aspx */*/*.aspx */*/*/*.aspx
:argdo %s/Inherits="\(\w*\)"/Inherits="WebSite\.\1"/ge|update
:args *.ashx */*.ashx */*/*.ashx */*/*/*.ashx
:argdo %s/" Class="\(\w*".*$\)/" class="WebSite\.\1"namespace WebSite{/ge|$s/$/}/ge|update
:args *.ascx */*.ascx */*/*.ascx */*/*/*.ascx
:argdo %s/ Inherits="\(\w*\)"/ Inherits="WebSite\.\1"/ge |update