Skip to content

Instantly share code, notes, and snippets.

@sibosend
sibosend / extract.sh
Created February 29, 2024 10:47
extract audio track from multiple .mp4 files
#!/bin/bash
eval "files=($(ls ./*/*))"
for f in "${files[@]}"; do
# printf '%s\n' "$f"
# printf '%s\n' './wangwangduimp3/'"$f"'.mp3'
ffmpeg -i $f -map 0:a -acodec libmp3lame -y './wangwangduimp3/'"$f"'.mp3'
done
@sibosend
sibosend / parse_yaml.sh
Created July 2, 2020 03:06 — forked from pkuczynski/LICENSE
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@sibosend
sibosend / new_harddisk.md
Created April 27, 2020 06:39
virtualbox增加新硬盘的方法

在virtualbox中装好Ubuntu后,发现硬盘空间太小,怎样才能增加硬盘容量?那就是再建一个硬盘:

  1. 添加新硬盘

    设置 -> Storage -> SATA控制器->右击,选择“添加虚拟硬盘”

    然后,根据需求创建合适的硬盘

  2. 重启虚拟机

查看现有系统的磁盘空间

@sibosend
sibosend / readme.md
Created April 21, 2020 07:41
ModuleNotFoundError: No module named '_gdbm' for python in OSX

vim ~/lib/python3.6/dbm/gnu.py from

from _gdbm import *

to

from _dbm import *

@sibosend
sibosend / readme.md
Last active April 17, 2020 06:26
Install VirtualBox Guest Additions in CentOS, RHEL & Fedora

yum -y install epel-release

yum -y update

yum install make gcc kernel-headers kernel-devel perl dkms bzip2

export KERN_DIR=/usr/src/kernels/$(uname -r)

mount -r /dev/cdrom /media

@sibosend
sibosend / add.sh
Last active April 16, 2020 08:51 — forked from sdoro/add.sh
Howto add/remove in VirtualBox a fifth NIC (without GUI) in hostonly networking
VBoxManage modifyvm "vm" --hostonlyadapter5 vboxnetX
VBoxManage modifyvm "vm" --nic5 hostonly
VBoxManage modifyvm "vm" --hostonlyadapter6 vboxnetX
VBoxManage modifyvm "vm" --nic6 hostonly
@sibosend
sibosend / MANIFEST.in
Created April 2, 2020 02:02 — forked from jpmens/MANIFEST.in
Including git version in setup.py files. (Requires at least _one_ tag in the repo) Normally used to make things like, "python setup.py sdist" give you a predictable name for files. Normally used with tags on the repo like 0.1 or 2.3.0 You should add RELEASE-VERSION to MANIFEST.in so that end users of the tarball can use this too.
include RELEASE-VERSION
include version.py
# Anything else you normally use
async def main():
coroutine1 = do_some_work(1)
coroutine2 = do_some_work(2)
coroutine3 = do_some_work(4)
tasks = [
asyncio.ensure_future(coroutine1),
asyncio.ensure_future(coroutine2),
asyncio.ensure_future(coroutine3)
]
  1. conda install -c anaconda pyzmq
  2. conda config --set channel_priority strict

keys

  • list all keys with prefix "local" ./etcdctl get /local --prefix