Skip to content

Instantly share code, notes, and snippets.

View zhaoxiaobao's full-sized avatar
🤒
Out sick

zhaoyuan zhaoxiaobao

🤒
Out sick
View GitHub Profile
@n1k0
n1k0 / gist:1501173
Created December 20, 2011 10:44 — forked from fbuchinger/gist:1501115
PhantomJS: Capturing single dom elements as png files
var page = new WebPage(),
address, output, size;
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clipRect) {
var previousClipRect;
var clipRect = {top: 0, left:0, width: 40, height: 40};
if (clipRect) {
if (!isType(clipRect, "object")) {
throw new Error("clipRect must be an Object instance.");
@davidwkeith
davidwkeith / index.html
Last active April 10, 2024 12:01
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom protocol handlers. Licensed under the WFTPL http://www.wtfpl.net/txt/copying/
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!--
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom
protocol handlers.
/*
http://benjithian.sg/2012/12/simple-background-subtraction/
Simple Background Subtraction. Simple stuff.
*/
#include <stdio.h>
#include <curl/curl.h>
#include <sstream>
#include <iostream>
#include <vector>
#include <opencv2/opencv.hpp>
@k4ml
k4ml / index.html
Last active May 15, 2024 09:23
PHP SSE Demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<script>
var source = new EventSource('updates.php');
source.onmessage = function(e) {
var updates;
@dannguyen
dannguyen / face-boxer-usage.md
Last active July 29, 2023 22:05
A face-detection script in Python

This face-boxer.py script is more-or-less the same code that you'll find in the OpenCV tutorial: Face Detection using Haar Cascades. For another variation, with more explanation, check out RealPython's tutorial.

Usage

The face-boxer.py script is designed to be run from the command-line. It has two required arugments:

  1. The path to a XML file containing a Haar-cascade of visual features. In this example, it will be the features that make up a face.
  2. The path to an image file that you want to perform face-detection on. You can pass in more than one image file as space-separated arguments.
@revolunet
revolunet / ffmpeg-tips.md
Last active October 6, 2023 17:47
ffmpeg tips

libcaca output from your OSX webcam

ffmpeg -f avfoundation -framerate 30 -s "640x480" -i "0" -c:v rawvideo -pix_fmt rgb24 -f caca -s "640x480" output4.mp4

brew install ffmpeg with options

brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-libcaca

convert to another format, resize withouth quality loss

ffmpeg -i vitrine.mp4 -vf scale=1024:-1 -q:vscale 0 vitrine.avi

@rupertqin
rupertqin / cities-latlng.js
Last active January 15, 2023 17:50
中国省市经纬度 JSON
var citiesLatLng = {
"municipalities": [
{
"name": "北京",
"g": {
"lng": "116.395645",
"lat": "39.929986"
}
},
{
@lzl
lzl / meteor-mongodb-backup-restore.md
Last active March 16, 2020 02:06
备份/恢复 Meteor 的 MongoDB 数据库

准备工作:

  1. 安装 Meteor
  2. 安装 Homebrew,是为了更方便地安装 MongoDB。
  3. 安装 MongoDB,是为了使用里面的 mongodumpmongorestore

备份与恢复本地数据库 (localhost):

  1. 在想要备份的应用目录下,meteor run
  2. 还是在相应的应用目录下,meteor mongo,查看相应的端口号,比如:如果显示的是 connecting to: 127.0.0.1:3001/meteor,那么端口号就是3001,下一步要用到。
{"lastUpload":"2020-04-30T04:17:22.471Z","extensionVersion":"v3.4.3"}
#!/usr/bin/env python2
# lrdcq
# usage python2 unwxapkg.py filename
import sys, os
import struct
class WxapkgFile(object):
nameLen = 0