Skip to content

Instantly share code, notes, and snippets.

@bao3
bao3 / wubi.emoji.dict.yaml
Last active February 16, 2016 10:17 — forked from lembacon/luna_pinyin.emoji.dict.yaml
Pinyin-Emoji Dictionary for Squirrel
# Rime dictionary
# encoding: utf-8
---
name: luna_pinyin.emoji
version: "2015.11.09"
sort: by_weight
use_preset_vocabulary: true
...
@bao3
bao3 / make-mega-adblock-hostsfile.sh
Created February 3, 2016 15:19
Create Mega Adblock Hostsfile for use with Dnsmasq (Modified from Pi-hole)
#!/bin/bash
# Modified Pi-hole script to generate a generic hosts file
# for use with dnsmasq's addn-hosts configuration
# original : https://github.com/jacobsalmela/pi-hole/blob/master/gravity-adv.sh
# Address to send ads to. This could possibily be removed, but may be useful for debugging purposes?
destinationIP="0.0.0.0"
outlist='./final_blocklist.txt'
tempoutlist="$outlist.tmp"
@bao3
bao3 / make-mega-adblock-hostsfile.sh
Created February 3, 2016 15:18 — forked from OnlyInAmerica/make-mega-adblock-hostsfile.sh
Create Mega Adblock Hostsfile for use with Dnsmasq (Modified from Pi-hole)
#!/bin/bash
# Modified Pi-hole script to generate a generic hosts file
# for use with dnsmasq's addn-hosts configuration
# original : https://github.com/jacobsalmela/pi-hole/blob/master/gravity-adv.sh
# The Pi-hole now blocks over 120,000 ad domains
# Address to send ads to (the RPi)
piholeIP="192.168.1.1"
outlist='./final_blocklist.txt'
@bao3
bao3 / hlink.c
Last active October 7, 2015 14:13
Mac OS X HardLink c file 苹果系统制作硬链接的命令行工具,原作者是 http://www.cppblog.com/biao/archive/2013/09/09/203123.html 。不过从他那边弄下来后会有错误,因此这里将修正好再托管。 顺道吐槽一下,妈的,google中文资料,一帮傻逼全在讨论 mac 硬连接软链接和替身,竟然都不告诉大家怎么制作硬链接。反而硬链接非常有必要,比如你同时有百度网盘,dropbox,onedrive,硬链接帮你解决需要重复放置同一份文件这个问题。
@bao3
bao3 / gist:4ad82a46e49a1aaa8132
Created January 24, 2015 14:03
WZR-HP-G300NH MMC/SD 可用
DI_pin 4
DO_pin 8
CLK_pin 7
CS_pin 3
mode 0
@bao3
bao3 / profile.xml
Last active September 21, 2017 02:59
用于 ocserv的profile.xml,会自动被思科客户端读取。这个配置文件有两个服务地址( VPN Server和 Full VPN Server),前者是区分路由模式的,后者是同一台服务不同端口的完全走VPN的模式。你可以在此基础上加入休眠后自动恢复项等等,但是请切记,一旦你改错了这个文档就会造成服务器不认证书或者客户端干脆禁止你连接。救赎的方法。。。。可耻的匿了。
<?xml version="1.0" encoding="UTF-8"?>
<AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd">
<ClientInitialization>
<UseStartBeforeLogon UserControllable="false">false</UseStartBeforeLogon>
<StrictCertificateTrust>false</StrictCertificateTrust>
<RestrictPreferenceCaching>false</RestrictPreferenceCaching>
<RestrictTunnelProtocols>IPSec</RestrictTunnelProtocols>
<BypassDownloader>true</BypassDownloader>
<WindowsVPNEstablishment>AllowRemoteUsers</WindowsVPNEstablishment>
@bao3
bao3 / cert-client.sh
Created October 6, 2014 08:31
这是几个用来签发证书的脚本,请注意这需要你安装了gnutls才可以,主要当时是为了ocserv而写,纯偷懒。基本上,你只要用 ./cert-client.sh you-user-name 这种格式,就可以自动生成 you-user-name-key.pem/ your-user-name-cert.pem /your-user-name.p12
#! /bin/sh
#! /usr/bin/expect -f
certtool --generate-privkey --outfile $1-key.pem
sed -i "1ccn = "${1}"" client.tmpl
sed -i "3cemail = ${1}@abc.org" client.tmpl
certtool --generate-certificate --load-privkey $1-key.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem --template client.tmpl --outfile $1-cert.pem
openssl pkcs12 -export -inkey $1-key.pem -in $1-cert.pem -name "$1 VPN Client Cert" -certfile ca-cert.pem -out $1.cert.p12
@bao3
bao3 / make.conf
Created May 6, 2014 07:18
FreeBSD make.conf 提高编译内核速度。通常来说,编译内核要depend 以及obj,然后还要把不需要的modules都编译好放在/boot/modules里面备用。所以要修改make.conf,因为我只想要一个kernel文件而已,其他的都不需要。
NO_MODULES=yes
NO_KERNELDEPEND=yes
NO_KERNELOBJ=yes
root@v2:~# cat /etc/asterisk/extensions.conf
;==================================
; extensions.conf - the Asterisk dial plan
;
[general]
static=no
writeprotect=no
autofallthrough=yes
clearglobalvars=no
priorityjumping=no
@bao3
bao3 / sip.conf
Last active February 17, 2016 12:29
root@v2:~# cat /etc/asterisk/sip.conf
;=================================
; SIP Configuration for Asterisk
;
[general]
context=sip ;默认使用extension.conf中的sip字段
videosupport=yes ;打开视频支持,有些客户端(手机)支持视频
textsupport = yes ;短信支持
ccept_outofcall_message = yes
outofcall_message_context = messages