Skip to content

Instantly share code, notes, and snippets.

View colynn's full-sized avatar
🎯
Focusing

Yuan.Liu colynn

🎯
Focusing
View GitHub Profile
@colynn
colynn / pointer_test.go
Created July 30, 2020 06:23
passing a pointer will always be faster than value, isn't it?
package main
import (
"encoding/json"
"testing"
)
type foo struct {
ID string `json:"_id"`
Index int `json:"index"`
@colynn
colynn / _config.yml
Last active August 14, 2020 05:12
add gitalk-comment/ utterances support for jekyll
# To use Gittalk comments https://github.com/gitalk/gitalk#Usage
# jekyll synatx: https://jekyllrb.com/docs/liquid/
gittalk:
# Note: A GitHub Application is needed for authorization, if you don't have one, going to https://github.com/settings/applications/new register a new one.
# You must specify the website domain url in the Authorization callback URL field.
clientID: # GitHub Application Client ID
clientSecret: # GitHub Application Client Secret,
repository: blog-comments # Storage gittalk's repository
owner: colynn # GitHub repo owner,
admin: colynn # GitHub repo owner and collaborators, only these guys can initialize github issues eg. 'colynn,daattali'
@colynn
colynn / 01_extract_crt.rb
Created May 30, 2018 08:13 — forked from miry/01_extract_crt.rb
Extract certificate from the kubernetes config.
require 'yaml'
require 'base64'
kube_path = File.join(ENV['HOME'], '.kube')
file_config = File.read File.join(kube_path, 'config')
config = YAML.load file_config
ca = Base64.decode64 config["clusters"][0]["cluster"]["certificate-authority-data"]
File.open(File.join(kube_path, 'ca.crt'), File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
f.write(ca)
@colynn
colynn / ansible-2.1-paramiko-api-bug
Created February 17, 2017 03:40
for ansible 2.1 api the bug of paramiko_ssh example
import os
import sys
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory
from ansible.executor.playbook_executor import PlaybookExecutor
def playbook_executor_instance(ex_vars):
#!/usr/bin/python3
import logging, sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory
from ansible.playbook.play import Play