Skip to content

Instantly share code, notes, and snippets.

@camark
camark / HardDeviceUtils.cs
Created February 14, 2017 01:05
获取硬盘ID
namespace com.gm
{
// Token: 0x02000026 RID: 38
public class HardDeviceUtils
{
// Token: 0x0600004E RID: 78 RVA: 0x0000411C File Offset: 0x0000231C
private static string GetHardDiskID()
{
string result = "";
try
@camark
camark / Ttx.java
Created February 10, 2017 08:44
Add 0 to number output
package com.gm;
import java.io.PrintStream;
import java.lang.reflect.Field;
public class Ttx {
public static void main(String[] args) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
// TODO Auto-generated method stub
@camark
camark / mib_tree.c
Created February 8, 2017 08:43 — forked from begeekmyfriend/mib_tree.c
MIB tree structure demo
/*
* This file is part of SmartSNMP
* Copyright (C) 2014, Credo Semiconductor Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@camark
camark / TableAndColumn.sql
Created January 10, 2017 03:05
得到SQL Server所有的表名和某个表的所有字段信息
#SQLServer查询某数据库所有表的表名:
select name from sysobjects where xtype='U';
#sqlserver查询某表的表结构:
SELECT syscolumns.name,systypes.name,syscolumns.isnullable, syscolumns.length
FROM syscolumns, systypes
WHERE syscolumns.xusertype = systypes.xusertype AND syscolumns.id = object_id('表名')
@camark
camark / removelast6.sh
Created January 3, 2017 02:36
删除最晚的6个文件
ls -lt *.sql | tail -n 6 |args '{print $9}' |xargs rm -rf
@camark
camark / GetMD5HashFromFile.cs
Created December 20, 2016 04:04
计算文件MD5值
private static string GetMD5HashFromFile(string fileName)
{
try
{
FileStream file = new FileStream(fileName, FileMode.Open);
System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] retVal = md5.ComputeHash(file);
file.Close();
StringBuilder sb = new StringBuilder();
@camark
camark / ConvertToChinese.cs
Created December 9, 2016 03:10
人民币转换-c#
作者:苏博
链接:https://www.zhihu.com/question/37926400/answer/74142424
来源:知乎
著作权归作者所有,转载请联系作者获得授权。
public static String ConvertToChinese(Decimal number)
{
var s = number.ToString("#L#E#D#C#K#E#D#C#J#E#D#C#I#E#D#C#H#E#D#C#G#E#D#C#F#E#D#C#.0B0A");
var d = Regex.Replace(s, @"((?<=-|^)[^1-9]*)|((?'z'0)[0A-E]*((?=[1-9])|(?'-z'(?=[F-L\.]|$))))|((?'b'[F-L])(?'z'0)[0A-L]*((?=[1-9])|(?'-z'(?=[\.]|$))))", "${b}${z}");
var r = Regex.Replace(d, ".", m => "负元空零壹贰叁肆伍陆柒捌玖空空空空空空空分角拾佰仟万亿兆京垓秭穰"[m.Value[0] - '-'].ToString());
@camark
camark / Shutdown.cpp
Created December 8, 2016 01:50
C关机
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hToken))
{
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
ExitWindowsEx(EWX_SHUTDOWN|EWX_POWEROFF, 0); //ExitWindowsEx(EWX_POWEROFF,0)) // 关闭计算机; ExitWindowsEx(EWX_REBOOT,0)
}
@camark
camark / Kaoqin.html
Created November 25, 2016 08:42
考勤表
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入 Bootstrap -->
<link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 Shim 和 Respond.js 用于让 IE8 支持 HTML5元素和媒体查询 -->
<!-- 注意: 如果通过 file:// 引入 Respond.js 文件,则该文件无法起效果 -->
@camark
camark / convertrmb.cpp
Created November 23, 2016 01:38
人民币大写
using std::vector;
using std::string;
using std::cout;
using std::cin;
using std::endl;
string ConvertMoney(double dNum)
{
string strResult;//要返回的字符串
char c_Digit[20];//c风格的字符数组