Skip to content

Instantly share code, notes, and snippets.

View huobazi's full-sized avatar
🎯
Focusing

Marble Wu huobazi

🎯
Focusing
View GitHub Profile
@huobazi
huobazi / CRUD_SP_Generation.sql
Created June 2, 2011 04:40 — forked from adamcarr/CRUD_SP_Generation.sql
Generate CRUD stored procedures from tables in schema
-- #########################################################
-- Author: www.sqlbook.com
-- Copyright: (c) www.sqlbook.com. You are free to use and redistribute
-- this script as long as this comments section with the
-- author and copyright details are not altered.
-- Purpose: For a specified user defined table (or all user defined
-- tables) in the database this script generates 4 Stored
-- Procedure definitions with different Procedure name
-- suffixes:
-- 1) List all records in the table (suffix of _GetAll)
@huobazi
huobazi / 1
Created July 22, 2011 04:22
添加 删除ubuntu自启动服务 init.d
1. 装个 sysv-conf-rc
2. sudo update-rc.d -f mysql remove 删除mysql随机器启动的服务
sudo update-rc.d -f apache2 remove 删除apache2随机器启动的服务
3. 查看/etc/rc2.d/里面的apache和mysql启动脚本,通常都是两个阿拉伯数字后再接一个英文字母,再加脚本名称。英文字母 是S的都是会自动启动的,K则相反。所以只要找到apache和mysql的启动脚本,把S改成K就可以了
@huobazi
huobazi / gist:1039424
Created June 22, 2011 03:04
Password masking in C# console application
/// <summary>
/// Gets the console secure password.
/// </summary>
/// <returns></returns>
private static SecureString GetConsoleSecurePassword( )
{
SecureString pwd = new SecureString( );
while ( true )
{
@huobazi
huobazi / logger.go
Last active March 22, 2023 14:13
golang, logrus, write log to stdout also write to files as the same time with different format
package logging
import (
"time"
"github.com/sirupsen/logrus"
"github.com/snowzach/rotatefilehook"
"github.com/mattn/go-colorable"
)
@huobazi
huobazi / deploy.rb
Created February 21, 2019 02:32 — forked from Epigene/deploy.rb
Mina deployment file for rails applications
# Mina Deploy
# ===========
#
# Adapted from Creative deploy stack in Manabalss v4, Mar.2015, updated to support staging on Jun.2015
# On first deploy do: mina setup --verbose
# Then do : mina deploy[initialize] --trace
#
# Usage examples:
# mina deploy[soft,seed,compile] to=staging # deploy task with all options | a simple `mina deploy` will deploy to production
# mina rake[db:seed] # for multi-argument tasks # mina 'rake[payments:refund[arg1\,arg2]]'
@huobazi
huobazi / gist:1172797
Created August 26, 2011 05:56
Regular expression to remove HTML comments
text = text.gsub(/<!--(.|\s)*?-->/,'')
@huobazi
huobazi / new-clearfix.css
Created May 18, 2011 07:27 — forked from jmblog/new-clearfix.css
new clearfix
/* new clearfix */
/* http://perishablepress.com/press/2009/12/06/new-clearfix-hack/ */
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
@huobazi
huobazi / sync.rb
Created September 23, 2011 04:55 — forked from dongyuwei/sync.rb
auto sync local workcopy to remote server
#author newdongyuwei@gmail.com
require 'rubygems'
require 'fsevents'
require 'net/ssh'
require 'net/scp'
require 'ruby-growl'
host = "10.210.74.63"
username = "my name"
password = "my password"
@huobazi
huobazi / minio.sh
Created July 6, 2022 07:21 — forked from corbtastik/minio.sh
Bash script to configure, start and stop single node MinIO container instance on Docker
#!/bin/bash
# --------------------------------------------------------------------
# [init] Create run dir, env file if they don't exist, then source env
# --------------------------------------------------------------------
init() {
MINIO_CONTAINER_NAME=$1
MINIO_RUN_DIR=/data1/run/${MINIO_CONTAINER_NAME}
MINIO_DATA=${MINIO_RUN_DIR}/data
MINIO_CERTS=${MINIO_RUN_DIR}/certs
# create run dir for container instance
@huobazi
huobazi / gist:997385
Created May 29, 2011 01:45
NERDTree Keys
111 o.......在已有窗口中打开文件、目录或书签,并跳到该窗口 .....|NERDTree-o|
112 go......在已有窗口中打开文件、目录或书签,但不跳到该窗口 .....|NERDTree-go|
113 t.......在新Tab中打开选中文件/书签,并跳到新Tab .....|NERDTree-t|
114 T.......在新Tab中打开选中文件/书签,但不跳到新Tab .....|NERDTree-T|
115 i.......split一个新窗口打开选中文件,并跳到该窗口 .....|NERDTree-i|
116 gi......split一个新窗口打开选中文件,但不跳到该窗口 .....|NERDTree-gi|
117 s.......vsp一个新窗口打开选中文件,并跳到该窗口 .....|NERDTree-s|
118 gs......vsp一个新窗口打开选中文件,但不跳到该窗口 .....|NERDTree-gs|
119 !.......执行当前文件 .....|NERDTree-!|
120 O.......递归打开选中结点下的所有目录 .....|NERDTree-O|