Skip to content

Instantly share code, notes, and snippets.

View beginor's full-sized avatar
💭
Coding for code!

beginor beginor

💭
Coding for code!
View GitHub Profile
@beginor
beginor / .gitignore
Last active December 16, 2015 02:29 — forked from mahdi/.gitignore
Log folder
#Junk Files
*.DS_Store
[Tt]humbs.db
#Log Folder
[Ll]og
#Visual Studio Files
[Oo]bj
[Bb]in
@beginor
beginor / gist:5525460
Last active December 17, 2015 00:59 — forked from androidcn/gist:5520805
public class TableViewSource<TEntity> : UITableViewSource
{
private IList<TEntity> _data;
public TableViewSource(IEnumerable<TEntity> data) {
this._data = data.ToList ();
}
public override int RowsInSection (UITableView tableview, int section)
@beginor
beginor / list-sqlserver-table-row-count.sql
Created August 20, 2013 03:26
How do I get a list of SQL Server tables and their row counts?
-- method 1
SET NOCOUNT ON
DECLARE @SQL VARCHAR(255)
SET @SQL = 'DBCC UPDATEUSAGE (' + DB_NAME() + ')'
EXEC(@SQL)
CREATE TABLE #foo (
tablename VARCHAR(255),
rc INT
@beginor
beginor / osversion.cs
Created December 9, 2013 03:18
System.Environment.OSVersion on windows, linux and mac osx
using System;
Console.WriteLine(Environment.OSVersion);
// on windows output is like:
// Microsoft Windows NT 6.2.9200.0, windows build number included
// on linux output is like:
// Unix 3.8.0.19, linux kernel included.
@beginor
beginor / android-debug-over-wifi.sh
Created December 13, 2013 09:26
debug android device over wifi
# enable on rooted device
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd
#disable on rooted device
setprop service.adb.tcp.port -1
stop adbd
start adbd
@beginor
beginor / insertion_sort.c
Created January 12, 2014 09:41
insertion sort demo in c
#include <stdio.h>
#include <stdlib.h>
void insertion_sort(int arr[], const int N);
void swap(int arr[], int i, int j);
void printArray(int array[]);
int main(int argc, char *argv[]) {
int array[] = { 10, 19, 13, 16, 20, 32, 27, 22, 15, 18, 21 };
printArray(array);
@beginor
beginor / ext-load-test.html
Created January 18, 2014 09:05
test load extjs on demand
<!DOCTYPE html>
<html>
<head>
<title>Load ExtJS on demand</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/ext-4/resources/css/ext-all.css" />
<script type="text/javascript" src="/ext-4/ext-debug.js"></script>
</head>
<body>
REGEDIT4
[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
"FontSmoothingType"=dword:00000002
"FontSmoothingGamma"=dword:00000578
"FontSmoothingOrientation"=dword:00000001
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"Arial"="WenQuanYi Micro Hei"
"Comic Sans MS"="WenQuanYi Micro Hei"
"Courier"="WenQuanYi Micro Hei Mono"
"Courier New"="WenQuanYi Micro Hei Mono"
"Fixedsys"="WenQuanYi Micro Hei"
"Helv"="WenQuanYi Micro Hei"
"Helvetica"="WenQuanYi Micro Hei"
1. 生成keystore
注册在填写名子与姓氏时需要填写tomcat的主机ip地址
keytool -genkey -v -alias tomcat -keyalg RSA -keystore tomcat.keystore -validity 365
2. 准备生成 CA 的key
openssl genrsa -out myCA.key 2048
3. 生成 CA
openssl req -x509 -new -key myCA.key -out myCA.cer -days 730 -subj /CN="Sencloudx Custom CA"
4. 准备从 CA 请求认证的请求文件
keytool -certreq -alias tomcat -keystore tomcat.keystore -file server.csr
5. 从CA请求认证