Skip to content

Instantly share code, notes, and snippets.

View hongqn's full-sized avatar
🏠
Working from home

Qiangning Hong hongqn

🏠
Working from home
View GitHub Profile
local obj = {}
obj.__index = obj
-- Metadata
obj.name = "HammerspoonSwitchIME"
obj.version = "0.1"
obj.author = "Qiangning Hong"
obj.license = "MIT"
local ENGLISH_ID = "com.apple.keylayout.US"
#!/usr/bin/env zsh
autoload colors; colors
run() {
local cmd="$1"
echo "🏃 $fg[green]$cmd$reset_color"
eval "$1"
}
"""Mirror https://haoel.blog.csdn.net/ to local directory."""
import time
from itertools import count
from subprocess import run
from typing import Iterator
import requests

$ cat ./productB.py

import os

os.environ["PRODUCT"] = "B"

import feature

print(feature.COST)
diff --git a/.p10k.zsh b/.p10k.zsh
index 71ef1ce..ccaf60d 100644
--- a/.p10k.zsh
+++ b/.p10k.zsh
@@ -1110,7 +1110,7 @@
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
# Show kubecontext only when the the command you are typing invokes one of these tools.
# Tip: Remove the next line to always show kubecontext.
- typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito'
+ typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|lain'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <unistd.h>
#include <stdio.h>
#define LOAD 16384
int main() {
int i;
char s[256];
for (i=0; i<LOAD; i++) {
@hongqn
hongqn / distribute_ssh_key.yml
Created July 27, 2015 02:30
Ansible playbook to distribute ssh public key to hosts
---
- hosts: all
gather_facts: no
tasks:
- local_action: command grep '{{ ansible_ssh_host }} ' /root/.ssh/known_hosts
register: exists
ignore_errors: True
changed_when: False
- local_action: shell ssh-keyscan -p {{ ansible_ssh_port|default(22) }} {{ ansible_ssh_host }}
register: result
@hongqn
hongqn / lain.toml
Created March 4, 2015 06:07
comparison of YAML and TOML
appname = "hello"
[build]
base = "go"
script = [ "go build" ]
[test]
script = [ "go test" ]
[web]
proxyon() {
export http_proxy="http://127.0.0.1:8123"
export https_proxy="http://127.0.0.1:8123"
}
proxyoff() {
unset http_proxy
unset https_proxy
}