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 / ntpdate.md
Created May 24, 2021 03:26
服务器同步网络时间

同步网络时间

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#!/bin/bash
#同步网络时间
echo “同步网络时间中…”
apt-get install -y ntpdate
ntpdate -u cn.pool.ntp.org
@huobazi
huobazi / Remove password from git commit history.md
Created September 13, 2020 15:04
Remove password from git commit history

在github上传了带密码的文件的删除方法

在 GitHub上Push了带密码的文件,就算删掉文件,commit 历史还是残留的。

怎样删除commit历史呢?

方法:

使用 git filter-branch 可以替换 commit 历史,然后 --force push。

@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 / Win7清除垃圾文件.bat
Last active August 22, 2020 06:38
Win7清除垃圾文件.bat
@echo off
color 0a
title windows7系统垃圾清理---
echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★
echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★
echo.★☆ ☆★
echo.★☆ ☆★
echo.★☆ 清理系统垃圾文件,请稍等...... ☆★
echo ★☆ ☆★
echo.★☆ ☆★
@huobazi
huobazi / Oracle_Csharp_Type.md
Last active July 24, 2020 10:26
Oracle 的 Numer类型与 C# 数据类型对应关系

[.NET: Int32] = [Oracle:NUMBER(2)..NUMBER(9)*]

[.NET: Int64] = [Oracle:NUMBER(10)..NUMBER(18)*]

[.NET: Double] = [Oracle:NUMBER(x, 0)..NUMBER(x, 15)*]

[.NET: Double] = [Oracle: FLOAT]

[.NET: Decimal] = [Oracle:NUMBER]

@huobazi
huobazi / dirty-magic-on-how-to-convert-bigint-to-int-in-mysql.sql
Created July 20, 2020 10:16
dirty-magic-on-how-to-convert-bigint-to-int-in-mysql
/*
ref: https://stackoverflow.com/questions/11595217/convert-bigint-unsigned-to-int#11595484
*/
/*
CREATE FUNCTION long2int (n BIGINT) RETURNS INT(11) RETURN n;
*/
SET @a:= CAST('111' AS SIGNED );
@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]));