Skip to content

Instantly share code, notes, and snippets.

View ferstar's full-sized avatar
🎯
Focusing

J. F. Zhang ferstar

🎯
Focusing
View GitHub Profile
@ferstar
ferstar / client.py
Created June 3, 2015 10:58
socket chat server & client
# Tcp Chat server
import socket, select
#Function to broadcast chat messages to all connected clients
def broadcast_data (sock, message):
#Do not send the message to master socket and the client who has send us the message
for socket in CONNECTION_LIST:
if socket != server_socket and socket != sock :
try :
@ferstar
ferstar / pull_all.sh
Created June 3, 2015 07:45
Clone all remote branches with Git
#!/bin/bash
# from http://stackoverflow.com/questions/67699/clone-all-remote-branches-with-git
# usage: sh -x pull_all.sh
# 在你的git目录下执行此脚本即可
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
git branch --track ${branch##*/} $branch
done
@ferstar
ferstar / ffmpeg.md
Last active August 29, 2015 14:21 — forked from v5tech/ffmpeg.md

视频切片* hls *

ffmpeg -i rtsp://192.168.1.234:8554/hi -f segment -segment_time 10 -segment_format mpegts -segment_list list_file.m3u8 -c copy -bsf:v h264_mp4toannexb -map 0 output_file-%d.ts

使用ffmpeg合并MP4文件

ffmpeg -i "Apache Sqoop Tutorial Part 1.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
@ferstar
ferstar / Atom_settings.md
Last active August 29, 2015 14:21
Atom编辑器设置

中文显示问题

在atom编辑器的设置--> font family选项中加入文泉驿的字体,比如文泉驿微米黑,然后将你喜欢的字体写在前面,就像这样:

DejaVu Sans Mono, WenQuanYi Micro Hei Mono

这条指令可以查看当前系统下的中文字体: fc-list :lang=zh 输出类似这样

@ferstar
ferstar / client.py
Created May 14, 2015 08:46
simple JSON TCP server and client
#!/usr/bin/env python3
import socket
import json
HOST, PORT = "localhost", 9527
data = {
"name": "hello, I am Tom.",
"age": 10,
"info": "sample is simple."
}
@ferstar
ferstar / opkg list-installed
Created November 6, 2013 14:00
installed packages
base-files - 43.32-r667
block-mount - 0.1.0-2.1
busybox - 1.15.3-3.1
crda - 1.1.1-1
dnsmasq - 2.55-6.1
dropbear - 0.53.1-5
firewall - 2-34.8
hotplug2 - 1.0-beta-3
iptables - 1.4.6-3.1
iptables-mod-conntrack - 1.4.6-3.1