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 / ubuntu-router.md
Created June 8, 2018 13:49
Ubuntu Router

Ubuntu 16.04 软件路由

服务器配置

操作系统 Ubuntu 16.04 LTS, 双网卡作软件路由

外网网卡配置

网络经光纤猫之后, 连接外网网卡, 名称 enp8s0 , 动态获取 ip 地址;

@beginor
beginor / pg-for-loop.sql
Last active September 27, 2018 07:56
postgres for loop
DO $$
DECLARE
st_time TIMESTAMP WITH TIME ZONE := '2016-03-01';
p RECORD;
BEGIN
RAISE INFO 'stat time is: % :', st_time;
FOR p IN
SELECT
r.id, r.water_source_code, r.water_source_name
FROM public.water_source_month_report r
@beginor
beginor / cesium.d.ts
Created October 4, 2017 01:37 — forked from thw0rted/cesium.d.ts
Updated typings file for Cesium v1.37.0
/**
* Cesium type definitions
* For use with Cesium v1.37.0
* Created by Aigars Zeiza <https://github.com/Zuzon>
* Modified by Harry Nicholls <harry@northstar-robotics.com>
* Updated for v1.37.0 by James Bromwell <https://github.com/Thw0rted>
*/
declare module "cesium"{
type RenderState = any;
@beginor
beginor / merge.sql
Created July 24, 2017 02:36
sqlserver merge table demo
MERGE into dbo.water_quality_data_his AS target
USING dbo.water_quality_data_his_temp AS source
ON (target.id = source.id)
WHEN MATCHED
THEN UPDATE SET
target.[id] = source.[id],
target.[point_id] = source.[point_id],
target.[item_id] = source.[item_id],
target.[item_name] = source.[item_name],
target.[item_unit] = source.[item_unit],
@beginor
beginor / update-hosts.sh
Created June 22, 2017 08:35
Update host through shell.
# update hosts
echo "Start update hosts"
echo "Create a new host file"
touch hosts
echo "Done!"
echo "Update AD block hosts ..."
curl https://raw.githubusercontent.com/vokins/yhosts/master/hosts >> hosts
echo "Done!"
echo "Update Google hosts ..."
curl https://raw.githubusercontent.com/sy618/hosts/master/p >> hosts
@beginor
beginor / systemjs.loader.dojo.js
Last active February 18, 2017 09:23 — forked from green3g/dojo.js
SystemJS Dojo Loader
exports.fetch = function(load) {
var name = load.name;
return new Promise(function(resolve) {
var dojoName = convertToDojoModule(name);
window.require([dojoName], function(mod) {
SystemJS.register(dojoName, [], function (exp, idObj) {
return {
setters: [],
execute: function() {
exp("default", mod);
@beginor
beginor / .editorconfig
Created January 17, 2017 03:06
editorconfig sample
# EditorConfig
# Top-most EditorConfig file
root = true
# * for all files
[*]
charset = utf-8
indent_style = space
indent_size = 4
tab_width = 4
end_of_line = lf
@beginor
beginor / beautiful.ts
Created November 28, 2016 09:16
parse and beautify javascript with uglify-js
import * as uglifyJs from 'uglify-js';
import * as path from 'path';
import * as fs from 'fs';
var p = path.resolve(__dirname, 'jsapi/esri/nls/zh-cn/jsapi.js');
console.log(p);
fs.readFile(p, { encoding: 'utf-8' }, (ex, data) => {
//console.log(data);
var result = uglifyJs.parse(data, {});
@beginor
beginor / RSACryptoService.cs
Created November 8, 2016 21:48
C# RSACryptoService with openssl rsa key
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace CMCloud.SaaS
{
@beginor
beginor / EvaluateString.java
Created November 8, 2016 10:01
A Java program to evaluate a given expression where tokens are separated by space.
/* A Java program to evaluate a given expression where tokens are separated
by space.
Test Cases:
"10 + 2 * 6" ---> 22
"100 * 2 + 12" ---> 212
"100 * ( 2 + 12 )" ---> 1400
"100 * ( 2 + 12 ) / 14" ---> 100
*/
import java.util.Stack;