Skip to content

Instantly share code, notes, and snippets.

@c02y
c02y / audio.py
Last active November 25, 2019 14:09
Download RoundTable mp3 files from http://english.cri.cn/4926/more/11680/more11680.htm
# -*- coding: utf-8 -*-
import os
import scrapy
import urllib.request
class AudioSpider(scrapy.Spider):
name = 'audio'
allowed_domains = ['english.cri.cn']
start_urls = ['http://english.cri.cn/4926/more/11680/more11680.htm']
@c02y
c02y / gist:3c672c049335097fb751463971139293
Last active January 10, 2021 11:03
manjaro unable to resize inside virtualbox
https://unix.stackexchange.com/a/536056/22322
To get Auto-Resize Guest Display working you have to use 'VBoxVGA'
Stop VM if installed and running
Choose in VM Setting: Display > Screen > Graphics Controller > 'VBoxVGA'
Save
Start VM with Manjaro - Screen goes black.
hit CTRL+ALT+F2 to enter tty2
logon
@c02y
c02y / init.el
Last active April 29, 2019 09:25
change the last line of C-w and C-x w to fix the problem when using for multiple blank lines(it will tab in only one blank line)
replace last line of C-w and C-x w to
(when (not (current-line-empty-p)) (indent-for-tab-command)))))
;; use different bullet for a sub-list
(setq org-list-demote-modify-bullet
'(("-" . "+") ("+" . "*") ("*" . "-") ("1." . "+") ("1)" . "+")
("a." . "-") ("a)" . "-") ("A." . "-") ("A)" . "-")))
;; Comment this line out, since it will cause the sub-list indentation problem,
@c02y
c02y / emm
Created April 29, 2019 03:06
fix the typo in emm -a
cmd="-e '(execute-kbd-macro (kbd \"C-c a a c\"))'"
@c02y
c02y / config.fish
Created April 29, 2019 03:00
one zips file to handle zip file
function zips -d 'zip to list(l)/extract(x)/create(c)'
set -l options 'l' 'L' 'c' 'x' 'X'
argparse -n zips $options -- $argv
or return
for a in $argv
if set -q _flag_l # list
unzip -l $a
else if set -q _flag_L # list Chinese characters
zips.py -l $a
@c02y
c02y / .condarc
Last active April 26, 2019 03:07
~/.condarc
channels:
- https://mirrors.cloud.tencent.com/anaconda/cloud/conda-forge/
- https://mirrors.cloud.tencent.com/anaconda/cloud/menpo/
- https://mirrors.cloud.tencent.com/anaconda/cloud/pytorch/
- https://mirrors.cloud.tencent.com/anaconda/cloud/bioconda/
- https://mirrors.cloud.tencent.com/anaconda/pkgs/main/
- https://mirrors.cloud.tencent.com/anaconda/pkgs/free/
- ripl-org
- lebedov
- conda-forge
@c02y
c02y / vimrc
Last active April 24, 2019 06:12
new vim plugin
" python-mode
Plugin 'klen/python-mode'
"default is python2
"let g:pymode_python = 'python3'
let g:pymode_options_colorcolumn = 0
Plugin 'wellle/targets.vim'
@c02y
c02y / gif
Last active April 26, 2019 11:37
gif recorder and converter
#!/bin/bash
print_usage()
{
cat <<EOF
$(basename $0) -- gif recorder and converter
Usage: $(basename $0) [-h] [-r] [-w] [-c] [time] [file]
-h to print this usage
-r to record a region
@c02y
c02y / config.fish
Last active April 26, 2019 03:05
clean abbrs/functions in config.fish
# replace tk and tka functions with one single function:
function tk -d 'tmux kill-session all(default)/single(id)/multiple(id1 id2)/except(-e)/list(-l) sessions'
if test (ps -ef | grep -v grep | grep -i tmux | wc -l ) = 0
echo "No tmux server is running!!!"
return
end
set -l options 'e' 'l'
argparse -n tk $options -- $argv
or return
@c02y
c02y / init.el
Last active April 26, 2019 10:16
org-agenda
(setq org-todo-keywords
;; !/@ meaning: https://orgmode.org/manual/Tracking-TODO-state-changes.html
'((sequence "TODO(t!)" "STARTED(s!)" "NEXT(n!)" "WAITING(w!)" "|" "DONE(d!)" "CANCELED(c@)")
;; multiple sets for one file
;; (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)""|" "FIXED(f)")
;; (sequence "|" "CANCELED(c)")
))
# put this before txt README