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 / 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 / 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 / SnowflakeIdGenerator.cs
Created September 2, 2020 08:24 — forked from jessejjohnson/SnowflakeIdGenerator.cs
Generate Twitter Snowflake ID's
public class SnowflakeIdGenerator
{
public const byte DefaultMachineIdBits = 6;
public const byte DefaultSequenceBits = 12;
private readonly long _machineId = 0;
private readonly byte _machineIdBits = 0;
private readonly byte _sequenceBits = 0;
private readonly long _maxSequence = 0;
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
private readonly object _lockObject = new object();
@huobazi
huobazi / Golang program stdin stdout interaction.md
Created September 1, 2020 09:01 — forked from jamesrr39/Golang program stdin stdout interaction.md
Using stdout and stdin from other programs in Golang

Go program interaction

Example of how to use stdout and stdin from other programs in golang

Requires go

Run

go run parentprocess.go
@huobazi
huobazi / gist:e410bec08320f3ae87bb2dcec8756a8a
Created July 17, 2020 03:11 — forked from imranbaloch/gist:10895917
SqlHelper.cs class with async support
// ===============================================================================
// Microsoft Data Access Application Block for .NET
// http://msdn.microsoft.com/library/en-us/dnbda/html/daab-rm.asp
//
// cs
//
// This file contains the implementations of the SqlHelper and SqlHelperParameterCache
// classes.
//
// For more information see the Data Access Application Block Implementation Overview.
using System;
using System.Collections;
using System.Data;
using MySql.Data.MySqlClient;
using System.Linq;
using System.Xml;
namespace OBALog.Data
{
[System.Diagnostics.DebuggerStepThrough]
@huobazi
huobazi / U2A.js
Created July 18, 2012 14:21 — forked from jayli/U2A.js
将基于10进制的字符串unicode编码转换为基于16进制的unicode字符串编码
// U2A('博时货');
// return '\u234A\u3BaD\u42EA\u1BC3'
var U2A = function(s){
var r = s.replace(/&#(\d+);/ig,'\\u{$1}');
var A = r.match(/\d+/ig);
for(var i = 0;i<A.length;i++){
r = r.replace('\\u{'+A[i].toString()+'}',String.fromCharCode(A[i]));