Skip to content

Instantly share code, notes, and snippets.

@ihciah
ihciah / subtitle_downloader.py
Last active July 14, 2024 17:23
Xunlei subtitle downloader
#!/usr/bin/python
# -*- coding: utf-8 -*-
# __author__ = 'ihciah'
# cid_hash_file function from https://github.com/binux/lixian.xunlei/blob/master/libs/tools.py
# Gist: https://gist.github.com/ihciah/30eda05ca36ee9f9f190067538b0ae04
import hashlib
import inotify.adapters
import os
import sys
# coding: utf-8
# 更新于2017/10/02,python3测试通过
import re
import requests
# 领取 X 铜币
# 每日登录奖励已领取
base_headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.57 Safari/537.36 OPR/40.0.2308.15 (Edition beta)', 'Referer': 'https://www.v2ex.com/signin', 'Origin': 'https://www.v2ex.com'}
@ihciah
ihciah / ss_install.sh
Created April 5, 2016 03:15
shadowsocks quick install
#!/bin/sh
sudo apt-get -y install curl python-pip
sudo pip install shadowsocks
sudo mkdir /etc/shadowsocks
printf "=====\nEnter your shadowsocks password\n=====\n"
read password
printf "=====\nEnter your shadowsocks port(>1024)\n=====\n"
read port
printf "\nConfigure shadowsocks with password: $password and at port: $port\n"
printf "{\n\t\"server\":\"::\",\n\t\"server_port\":$port,\n\t\"local_port\":10800,\n\t\"password\":\"$password\",\n\t\"timeout\":600,\n\t\"method\":\"rc4-md5\"\n}" | sudo tee /etc/shadowsocks/config.json > /dev/null
@mik30s
mik30s / webcam_capture.cpp
Last active October 26, 2024 01:20
Simple C++ program to capture a webcam frame in Linux
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <linux/ioctl.h>
#include <linux/types.h>
#include <linux/v4l2-common.h>
#include <linux/v4l2-controls.h>
#include <linux/videodev2.h>
#include <fcntl.h>
#include <unistd.h>