Skip to content

Instantly share code, notes, and snippets.

View rc1021's full-sized avatar

許益銘 rc1021

View GitHub Profile
@rc1021
rc1021 / install-docker.md
Created March 22, 2021 13:04 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@rc1021
rc1021 / getall.sh
Created January 20, 2021 02:53
获取所有币信息 (USER_DATA)
#!/usr/bin/env bash
# Set up authentication:
# apiUrl="https://testnet.binance.vision"
apiUrl="https://api.binance.com"
apiKey=""
secretKey=""
# Set up the request:
apiMethod="GET"
@rc1021
rc1021 / Remove all git tags
Created November 20, 2020 07:11 — forked from okunishinishi/Remove all git tags
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
input {
beats {
port => "5044"
}
}
filter {
## Ignore the comments that IIS will add to the start of the W3C logs
#
if [message] =~ "^#" {

Querying JSON with SelectToken and Linq Descendants

使用 Newtonsoft 的 SelectToken 取得 Path 節點的內容值,以及 Descendants 拜訪節點

以下的範例我們將使用這個 Json 結構進行說明

JObject o = JObject.Parse(@"{
  'Stores': [
    'Lambton Quay',
 'Willis Street'
function queryStringToJson(s="")
{
return JSON.parse(s.replace(/[?|&]([A-Za-z0-9]*)=([^&]*)/ig, ",\"$1\":\"$2\"").slice(1).replace(/(.*)/, "{ $1 }"));
}
/*----------------------------------------------------*/
/* MOBILE DETECT FUNCTION
/*----------------------------------------------------*/
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
@rc1021
rc1021 / ParsedUrl.js
Last active April 3, 2018 08:59 — forked from acdcjunior/ParsedUrl.js
Cross-browser URL parsing in JavaScript
function ParsedUrl(url) {
this.parse(url);
}
ParsedUrl.prototype.parse = function (url) {
var parser = document.createElement("a");
parser.href = url;
// IE 8 and 9 dont load the attributes "protocol" and "host" in case the source URL
// is just a pathname, that is, "/example" and not "http://domain.com/example".
@rc1021
rc1021 / webpack.config.js
Created February 2, 2018 07:39 — forked from JesterXL/webpack.config.js
Example webpack for ES6 unit testing
'use strict';
// Modules
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var _ = require('lodash');
@rc1021
rc1021 / main.html
Last active December 24, 2017 12:36
demo serializeArray of form to json object
<!DOCTYPE html>
<html>
<head>
<title>demo serializeArray of form to json object</title>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<form>
<input type="text" name="desc" value="demo serializeArray of form to json object.">
<input type="text" name="users[0].name" value="user A">