Skip to content

Instantly share code, notes, and snippets.

@shawn111
shawn111 / rust.md
Last active February 6, 2024 10:13
rust.md
options title author
implicit_slide_ends
true
Kubernetes meets Rust
Shawn Wang @ TOOCON 2402
{"level":"error","ts":1571814536.6378398,"caller":"mlog/log.go:173","msg":"Command with a trigger of 'helloabc' returned response 500 INTERNAL SERVER ERROR","path":"/api/v4/commands/execute","request_id":"mwa1qptwajft3bij3euhttgcoc","ip_addr":"114.40.146.117","user_id":"zcouasondpnxmjot3m7wg64tbw","method":"POST","err_where":"command","http_code":500,"err_details":"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n <head>\n <title>json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) // Werkzeug Debugger</title>\n <link rel=\"stylesheet\" href=\"?__debugger__=yes&amp;cmd=resource&amp;f=style.css\"\n type=\"text/css\">\n <!-- We need to make sure this has a favicon so that the debugger does\n not by accident trigger a request to /favicon.ico which might\n change the application state. -->\n <link rel=\"shortcut icon\"\n href=\"?__debugger__=yes&amp;cmd=resource&amp;f=console.png\">\
@shawn111
shawn111 / ks
Last active May 30, 2019 16:00
install
cdrom
lang en_US.UTF-8
keyboard us
unsupported_hardware
network --bootproto=dhcp --hostname centos-7.pelmet.loc
rootpw vagrant
firewall --disabled
selinux --permissive
timezone --utc Asia/Shanghai
const Limit = 50
func doKojiLatestBuild(worker int, repo string, pkg string, results chan<- string) {
build := KojiLatestBuild(repo, pkg)
fmt.Println(worker, repo, pkg, ">>", build)
results <- build
}
func KojiListLatestBuilds(repo string) []string {
pkgs := KojiListPackages(repo)
func KojiListLatestBuilds(repo string) []string {
wg := sync.WaitGroup{}
queue := make(chan string)
doWork := func(i int, pkg string) string {
build := KojiLatestBuild(repo, pkg)
fmt.Printf("Worker %d working on %s - %s\n", i, pkg, build)
return build
}
? gitlab.com/shawn111/foo [no test files]
? gitlab.com/shawn111/foo/actions [no test files]
=== RUN TestInValidCommand
--- PASS: TestInValidCommand (0.00s)
=== RUN TestFakeShellCommandTestSuite
=== RUN TestFakeShellCommandTestSuite/TestCopyAllRPMs
testing: warning: no tests to run
PASS
coverage: 0.0% of statements
=== RUN TestFakeShellCommandTestSuite/TestCopyFile
@shawn111
shawn111 / instructions
Last active May 10, 2018 14:43 — forked from cdelorme/instructions
Automatically Update Remote Authorized Keys
I tend to break and rebuild my systems regularly. It has gotten to the point that I generally do not have an SSH key for over a year.
This has created a serious dilemma when it comes to maintaining access to remote systems. I usually disable normal password access on any servers I maintain, which means unless I have multiple systems that can access so I can replace the keys I could permanently loose access to those systems. In considering possible solutions I came up with one that has saved my bacon regularly.
First, I use my [dot-files](https://github.com/cdelorme/dot-files) repository after installing any new system. If that system is secure I will generate a new SSH key and load it into github via curl through their api.
On servers which I need to retain access, I create a simple bash script to poll my github accounts keys. I throw it into a user-local `~/.bin/update-keys` file, and make it executable.
Finally, I modify the crontab to execute this script regularly:
#!/bin/bash
# This script add git commit info in spec `Release`
# https://fedoraproject.org/wiki/Archive:Tools/RPM/VersionComparison?rd=Tools/RPM/VersionComparison
#
# eg.
# (1)
# prev version (tag) 1.5
# new version still 1.5 but we want to modify the spec
# * don't change any version (version/ release)
#!/bin/sh
set -e
set -x
RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp selinux"}"
PROXY_LDFLAGS="-linkmode=external"
TARGET_PATH=${TARGET_PATH:-"/usr/local/bin"}
[escore-atomic]
name=ESCore-7 - atomic
#baseurl=http://mirror.easystack.io/ESCL/vault.es/7.4.1708/atomic/x86_64/
baseurl=http://mirror.easystack.io/ESCL/vault.es/7.3.1611/atomic/x86_64/
#baseurl=http://mirror.easystack.io/koji-escl/repos/es7.4-docker/latest/x86_64/
enabled=1
gpgcheck=0
username=escore
password=escore