Skip to content

Instantly share code, notes, and snippets.

View sdvcrx's full-sized avatar
🎯
Focusing

sdvcrx sdvcrx

🎯
Focusing
View GitHub Profile
@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
@sdvcrx
sdvcrx / conv.sh
Created July 11, 2014 06:39
从视频中提取一个声道并重新封装,解决部分视屏只有左边声音的问题
#!/bin/sh
############
# require:
# - ffmpeg
# - faad
# - sox
############
aac="audio.aac"
@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 / 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 / inplace_swap.c
Created August 6, 2013 12:44
无中间变量交换两值
void inplace_swap(int *x, int *y)
{
*y = *x ^ *y;
*x = *x ^ *y;
*y = *x ^ *y;
}
@sdvcrx
sdvcrx / endian.c
Created August 8, 2013 03:14
辨别系统是64位 or 32位以及大小端
#include <stdio.h>
int main(void)
{
int a = 0x80000000;
printf("os is %d\t%d\n", a, sizeof(int));
union ut {
short s;
char c[2];
} u;
@sdvcrx
sdvcrx / backup.sh
Created August 10, 2013 13:37
MySQL简单的备份恢复(mysqldump)
mysqldump -u root -p linuxcast > linuxcast_backup.sql
mysql -u root -p linuxcast < linuxcast_backup.sql
@sdvcrx
sdvcrx / MultiBaseOutput.c
Created August 17, 2013 14:40
数制转换
#include <stdio.h>
#define MAXSIZE 25
#define OK 1
#define ERROR 0
typedef int Status;
typedef int SElemType;
typedef struct {
SElemType data[MAXSIZE];
@sdvcrx
sdvcrx / thunder.py
Created August 20, 2013 01:33
迅雷链接转换
import base64
def xunlei_url_encode(url):
return 'thunder://'+base64.encodestring('AA'+url+'ZZ').replace('\n', '')
def xunlei_url_decode(url):
assert url.startswith('thunder://')
url = base64.decodestring(url[10:])
assert url.startswith('AA') and url.endswith('ZZ')
return url[2:-2]
@sdvcrx
sdvcrx / bucket.c
Created September 22, 2013 07:20
木桶排序
#include <stdio.h>
#define MAXNUM 100 // Count数组大小(M)
/* 功能:桶式排序
* 输入: 待排序数组arrayForSort[]
* 待排序数组大小arraySize (N)
* 上界maxitem,元素都落在[0, maxitem]
* 输出 void
* 时间复杂度 O(M+N)
*/