Skip to content

Instantly share code, notes, and snippets.

@zhsj
zhsj / ansible.spec
Created December 2, 2016 03:16
ansible pyinstaller
# -*- mode: python -*-
import os
import six
import ansible
block_cipher = None
a = Analysis(['controller.py'],
pathex=None,
binaries=None,
@zhsj
zhsj / cat.go
Created September 13, 2022 15:49
🐱
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"io"
"log"
"os"
@zhsj
zhsj / select-class.js
Created August 29, 2013 11:41
select the course whose id is 011X1902 in USTC automatically.
function myfun(tag,actionname,xnxq,kcid,kcbjbh,kclb,kcsx,sjpdm,kssjdm,cxck,zylx,gxkfl,xlh,qsz,jzz){
insertxkgc(xnxq,kcbjbh,kcid,kclb,kcsx,cxck,'01',gxkfl,xlh,sjpdm,kssjdm);
}
function myfun2(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET",location.href,false);
xmlhttp.send();
var x=xmlhttp.responseText.match("<font color=blue>40</font></a>");
if(x!=null){
@zhsj
zhsj / nutstore-pydaemon.py
Last active January 16, 2020 09:04
nutstore-pydaemon.py python3 port
#!/usr/bin/env python3
# vim: set sw=4 ts=4:
import socket
import os
import threading
import time
import sys
import platform
import tempfile
import fcntl
@zhsj
zhsj / oauth2.py
Created December 26, 2019 17:51
mutt oauth refresh command
#!/usr/bin/python3
import json
import argparse
import urllib.request
import urllib.parse
client_id = "1008555780204-finbc9qn6gss7t099l96t1pbqmidv9hm.apps.googleusercontent.com"
client_secret = ""
@zhsj
zhsj / clean-images.py
Created August 9, 2019 15:10
clean containerd cri images
#!/usr/bin/python3
import json
import itertools
import subprocess
out = subprocess.check_output(["crictl", "images", "-o", "json"])
images = json.loads(out.decode("utf-8"))
tags = itertools.chain.from_iterable([i["repoTags"] for i in images["images"]])
for repo, repo_tags in itertools.groupby(tags, lambda x: "".join(x.split(":")[:-1])):
@zhsj
zhsj / conky.service
Created June 23, 2015 09:49
Conky systemd user service
# ~/.config/systemd/user/conky.service
[Unit]
Description=Conky
[Service]
Type=simple
ExecStart=/usr/bin/conky
Environment=DISPLAY=:0
@zhsj
zhsj / rsa.go
Last active May 10, 2019 17:45
encrypt with RSA private key and decrypt with public key
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
@zhsj
zhsj / tv.py
Created January 28, 2019 16:07
play url on tv
#!/usr/bin/env python3
from contextlib import contextmanager
import re
import select
import socket
import sys
import urllib.request
@zhsj
zhsj / sks-poison-key.patch
Created July 16, 2018 03:54
sks poison key
diff --git a/keydb.ml b/keydb.ml
index 949a1f4..7ff976a 100644
--- a/keydb.ml
+++ b/keydb.ml
@@ -1166,6 +1166,11 @@ struct
try
if has_hash hash then [] else
let keyid = Fingerprint.keyid_from_key ~short:true key in
+ let keyid_long = Fingerprint.keyid_to_string ~short:false (Fingerprint.keyid_from_key ~short:false key) in
+