Skip to content

Instantly share code, notes, and snippets.

View sdvcrx's full-sized avatar
🎯
Focusing

sdvcrx sdvcrx

🎯
Focusing
View GitHub Profile
{{ $repo := .Get "repo" }}
{{ $detail := getJSON "https://api.github.com/repos/" $repo }}
<article class="shortcode-card">
<a href="https://github.com/{{ $repo }}" target="_blank" rel="noopener">
<header>
<img alt="{{ $repo }}" src="https://opengraph.githubassets.com/1/{{ $repo }}" />
</header>
<div class="shortcode-card-content">
<h2>{{ .Get "repo" }}</h2>
{{ with $detail }}
@sdvcrx
sdvcrx / migrate.py
Last active December 28, 2021 02:54
Sync dockerhub images to ghcr.io or other registry
"""
Sync dockerhub images to ghcr.io or other registry
Usage:
1. create tag list file `tags.txt` that syncing to ghcr.io
```
git tag > tags.txt
Vue.js 14 hrs 16 mins ███████████▎░░░░░░░░░ 53.9%
JavaScript 6 hrs 38 mins █████▎░░░░░░░░░░░░░░░ 25.1%
Other 2 hrs 35 mins ██░░░░░░░░░░░░░░░░░░░ 9.8%
Go 1 hr 42 mins █▎░░░░░░░░░░░░░░░░░░░ 6.4%
Git 41 mins ▌░░░░░░░░░░░░░░░░░░░░ 2.6%

fmt

%T: print type of variable

Slice

Usage

Create a slice:

@sdvcrx
sdvcrx / archlinux-cleanup-pkg.go
Created January 30, 2017 09:56
Cleanup cached pkg files on Archlinux
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"regexp"
"sort"
)
@sdvcrx
sdvcrx / cvim.css
Last active February 29, 2016 13:50
cvim
#cVim-link-container, .cVim-link-hint, #cVim-command-bar, #cVim-command-bar-mode, #cVim-command-bar-input, #cVim-command-bar-search-results, .cVim-completion-item, .cVim-completion-item .cVim-full, .cVim-completion-item .cVim-left, .cVim-completion-item .cVim-right, #cVim-hud, #cVim-status-bar {
font-family: Helvetica, Helvetica Neue, Neue, sans-serif, monospace, Arial;
font-size: 12pt !important;
-webkit-font-smoothing: antialiased !important;
}
#cVim-link-container {
position: absolute;
pointer-events: none;
width: 100%; left: 0;
@sdvcrx
sdvcrx / dkms-remove.sh
Created May 7, 2015 11:27
Remove dkms module
#!/bin/bash
if [ -z "$1" ] ; then
echo "$(basename "$0") kernel-ver"
exit 1
fi
PACKAGES=(`dkms status | grep "$1" | awk -F ', ' '{ print $1"/"$2 }'`)
@sdvcrx
sdvcrx / counter.py
Created December 9, 2014 14:20
把重复数字出现的次数按从多到少排列打印出来
from collections import Counter
num = "135481963636"
n = Counter(num)
for key, freq in n.most_common():
print("{0}: {1}".format(key, freq))
@sdvcrx
sdvcrx / conv.sh
Created July 11, 2014 06:39
从视频中提取一个声道并重新封装,解决部分视屏只有左边声音的问题
#!/bin/sh
############
# require:
# - ffmpeg
# - faad
# - sox
############
aac="audio.aac"
@sdvcrx
sdvcrx / aria2.conf
Last active August 29, 2015 13:55
popobox configure
#===请按实际情况修改路径
#定时保存进度
#input-file=/root/.aria2/aria2.session
save-session=/root/.aria2/aria2.session
#定时保存会话,需要1.16.1之后的release版
save-session-interval=1200
#文件保存路径, 默认为当前启动位置
dir=/mnt/disks/sda4/Downloads/
# fix EOF error