Skip to content

Instantly share code, notes, and snippets.

View xiangzhuyuan's full-sized avatar
🤗

Mathew P. Jones xiangzhuyuan

🤗
View GitHub Profile
# -- coding: utf-8
require "pp"
require "rubygems"
require 'sinatra'
require 'sinatra/base'
module Sinatra
module Helpers
class Stream
@chetan
chetan / yardoc_cheatsheet.md
Last active May 4, 2024 11:12
YARD cheatsheet
@claylevering
claylevering / bitly.sh
Created February 15, 2012 02:20
Bit.ly Alfred App Extension
# modified API url to align with changes to bit.ly requirements - @claylevering
# find the .alfredextension here: http://cl.ly/EEUK
declare -r API='https://api-ssl.bitly.com/v3/shorten'
declare -r LOGIN='yourlogin'
declare -r API_KEY='yourapi'
# add http scheme to URL if none is provided
longURL=$(printf "{query}" | sed -E -e 's|^.|http://&|' -e 's|^http://([a-zA-Z\-\.\+]+://)|\1|')
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@crazy4groovy
crazy4groovy / dirHtmlPageRenderToPng.js
Created July 22, 2012 15:57
PhantomJS script to loop through local directory and render HTML pages as PNG
/* tested on PhantomJS 1.6 */
var page = require('webpage').create(), loadInProgress = false, fs = require('fs');
var htmlFiles = new Array();
// console.log(fs.workingDirectory);
// console.log(phantom.args[0]);
var curdir = phantom.args[0] || fs.workingDirectory;
var curdirList = fs.list(curdir);
@xiangzhuyuan
xiangzhuyuan / gist:5133140
Created March 11, 2013 09:51
about date
package com.demo;
import java.util.Calendar;
import java.util.Date;
public class DemoDateUtil {
//static DateUtil du = new DateUtil();
/**
* @param args
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
@mustafaturan
mustafaturan / latest-ffmpeg-centos6.sh
Last active October 25, 2022 20:14
Installs latest ffmpeg on Centos 6
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
@lanrion
lanrion / gist:9479631
Last active December 5, 2023 08:20
浅析微信信息信息接收与信息回复

微信的信息接收与回复,两者是独立的。

信息接收

共同点在于:都有 ToUserName,FromUserName,CreateTime,MsgType, 这四个字段。

在信息接收方面,分为“普通消息”、“事件推送”,“语音识别结果(微信用户发送语音,微信服务器翻译成文本,只不过比语音消息多一个识别结果字段:Recognition)”。

  • 文本消息(通过“Content”关键字来获取文本内容,这点比较重要,也是使用比较多的场合)
  • 图片消息

测试平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2

运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件