Skip to content

Instantly share code, notes, and snippets.

@yeetim
yeetim / .Title
Created December 5, 2018 16:33 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo
@yeetim
yeetim / README.md
Created October 9, 2018 04:26 — forked from mrbar42/README.md
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster
@yeetim
yeetim / simple-pagination.js
Created May 10, 2018 03:59 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@yeetim
yeetim / main.go
Created May 9, 2018 06:04 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
#!/usr/bin/env python
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
#
ffmpeg功能极其强大,堪比图像处理的ImageMagik。下面是一些常用的命令,记下备用。
1:得到视频信息
ffmpeg -i input.xxx
2: 将图像序列转换为视频
ffmpeg -f image2 -i prefix%d.jpg output.xxx
3:将视频转换为图像序列
ffmpeg -i input.xxx -r FPS -qscale 1 -vsync 0 $prefix%d.jpg
其中FPS为每秒抽多少帧
4:将视频转换为yuv格式
ffmpeg -i input.avi ouput.yuv
@yeetim
yeetim / ffmpeg.md
Created January 20, 2016 05:29 — forked from v5tech/ffmpeg.md
ffmpeg视频合并、格式转换、截图

使用ffmpeg合并MP4文件

ffmpeg -i "Apache Sqoop Tutorial Part 1.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i "Apache Sqoop Tutorial Part 2.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "Apache Sqoop Tutorial Part 3.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts
ffmpeg -i "Apache Sqoop Tutorial Part 4.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate4.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermediate3.ts|intermediate4.ts" -c copy -bsf:a aac_adtstoasc "Apache Sqoop Tutorial.mp4"
@yeetim
yeetim / lnmp.sh
Last active August 29, 2015 14:07
lnmp.sh
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
cur_dir=$(pwd)
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install lnmp"
exit 1
fi
clear
echo "========================================================================="
@yeetim
yeetim / cmd
Last active August 29, 2015 14:06
#查看当前TCP链接状态
netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'
#CLOSED: 无连接是活动的或正在进行
#LISTEN: 服务器在等待进入呼叫
#SYN_RECV: 一个连接请求已经到达,等待确认
#SYN_SENT: 应用已经开始,打开一个连接
#ESTABLISHED:正常数据传输状态
#FIN_WAIT1: 应用说它已经完成
#FIN_WAIT2: 另一边已同意释放
#ITMED_WAIT: 等待所有分组死掉
@yeetim
yeetim / hwconfig
Created September 20, 2014 07:07
#!/usr/bin/perl -w
# $Header: /CVSROOT/yahoo/ops/software/hwconfig/hwconfig,v 1.51.2.1 2008/11/06 01:01:10 filo Exp $
use strict 'vars';
use Getopt::Std;
use POSIX;
# constants
$ENV{PATH} = "/etc/bin:/sbin:/usr/sbin:/bin:/usr/bin:/home/y/bin:/usr/local/bin:/usr/local/sbin:/home/opt:/opt/MegaRAID/MegaCli:/usr/StorMan";