Skip to content

Instantly share code, notes, and snippets.

View kitelife's full-sized avatar
💪
I may be slow to respond.

xiayf kitelife

💪
I may be slow to respond.
View GitHub Profile
@kitelife
kitelife / ffmpeg.md
Created August 19, 2017 05:30 — 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"
<?php
function checkIPClass($ip) {
$ipLong = ip2long($ip);
if ($ipLong == -1 || $ipLong === FALSE) {
return null;
}
$ipBinaryString = sprintf('%b', $ipLong);
$ipBinaryString = str_pad($ipBinaryString, 32, '0', STR_PAD_LEFT);
cat words.txt | sort | uniq -c | sort -k1,1nr | head -10
/*
sort: 对单词进行排序
uniq -c: 显示唯一的行,并在每行行首加上本行在文件中出现的次数
sort -k1,1nr: 按照第一个字段,数值排序,且为逆序
head -10: 取前10行数据
*/
cat filter.log | awk -F '[' '{print $4}' | awk -F ':' '{print $1}' | sort | uniq -c | sort -k1,1nr | head -10
#!/bin/sh
for host in drops.wooyun.org www.aqniu.com www.freebuf.com
do
/usr/bin/wget http://$host/feed -O /home/work/feeds/$host/feed_$(date "+%Y-%m-%d-%H_%M_%S").xml >> /home/work/feeds/$host/wget.log 2>&1
done
private HashMap<String, Object> jsonToMap(String t) throws JSONException {
HashMap<String, Object> map = new HashMap<String, Object>();
JSONObject jObj = new JSONObject(t);
Iterator<?> keys = jObj.keys();
while (keys.hasNext()) {
String key = (String) keys.next();
map.put(key, jObj.get(key));
}
return map;
}
object Test extends App {
val a = Array(10, 9, -1, 8, -2, -100, 1000).toBuffer
var first = true
val indexes = for (i <- 0 until a.length if first || a(i) >= 0) yield {
if (a(i) < 0)
first = false
i
}
for(j <- 0 until indexes.length)
a(j) = a(indexes(j))
@kitelife
kitelife / lonlat.js
Created May 10, 2015 13:15
经纬度距离计算
var appFunc = {
getDistance: function (firstLon, firstLat, secondLon, secondLat) {
var radFirstLon = appFunc.rad(firstLon);
var radFirstLat = appFunc.rad(firstLat);
var radSecondLon = appFunc.rad(secondLon);
var radSecondLat = appFunc.rad(secondLat);
var latDiff = radFirstLat - radSecondLat;
var lonDiff = radFirstLon - radSecondLon;
@kitelife
kitelife / deepCopy.js
Created April 30, 2015 07:19
深拷贝
function deepCopy(p, c) {
c = c || {};
for (var i in p) {
if (p.hasOwnProperty(i)) {
if (typeof p[i] === 'object') {
c[i] = Array.isArray(p[i]) ? [] : {};
deepCopy(p[i], c[i]);
} else {
c[i] = p[i];
}
@kitelife
kitelife / extendCopy.js
Created April 30, 2015 07:10
对象之间的继承
function extendCopy(p) {
var c = {};
for (var i in p) {
c[i] = p[i];
}
c.uber = p;
return c;
}
@kitelife
kitelife / extend_by_copy.js
Created April 30, 2015 06:55
简单地通过将父对象的属性拷贝给子对象来构建继承
function extend(Child, Parent) {
var p = Parent.prototype;
var c = Child.prototype;
for (var i in p) {
c[i] = p[i];
}
c.uber = p;
}