Skip to content

Instantly share code, notes, and snippets.

View lsongdev's full-sized avatar
👨‍💻
Thinking ...

Lsong lsongdev

👨‍💻
Thinking ...
View GitHub Profile
@lsongdev
lsongdev / wechat-simsimi.js
Last active August 29, 2015 14:07
demo case for simsimi
var express = require('express');
var xmlParser = require('express-xml');
var wechat = require('wechat-lite');
var Simsimi = require('simsimi');
var app = express();
var simsimi = new Simsimi({
lc : 'zh',
key: '7f503329-9755-49dc-95d3-c586cf578914'
#!env bash
HOST="acg.sugling.in"
HEADER="User-Agent: ACGArt/4.4.11 CFNetwork/672.1.15 Darwin/14.0.0"
URL="http://$HOST/json_daily.php?device=iphone5&pro=yes&user=yes&sexyfilter=no&version=m.4.4.11"
curl -H "$HEADER" $URL | underscore select .imgs | underscore flatten --outfmt text | awk '{ print "http://acg.sugling.in/_uploadfiles/iphone5/640/"$1 }' | xargs -n1 wget
@lsongdev
lsongdev / README.md
Last active September 18, 2021 08:38
Simple startup script for Mongodb on Mac OS X

Simple startup script for Mongodb on Mac OS X

Installtion

Simple and easy 😄

curl -s https://gist.githubusercontent.com/song940/75d2192886d865032726/raw/install.sh | bash
@lsongdev
lsongdev / yangcong-helper.js
Last active April 5, 2016 08:18
洋葱数学 自动显示正确答案.
/**
* [YangCongHelper]
* @param {[type]} window [global]
* @param {[type]} jq [jQuery]
* @param {[type]} undefined [undefined]
* @return {[type]} [nothing]
*/
;(function(window, jq, undefined){
/**
* [YangCongHelper Class]
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
#!/bin/bash
/etc/init.d/ntp stop
until ping -nq -c3 8.8.8.8 > /dev/null; do
echo "Waiting for network..."
done
ntpdate -s time.nist.gov
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
import commands
def get_cpu_temp():
tempFile = open( "/sys/class/thermal/thermal_zone0/temp" )
cpu_temp = tempFile.read()
tempFile.close()
return float(cpu_temp)/1000
# Uncomment the next line if you want the temp in Fahrenheit
#return float(1.8*cpu_temp)+32
import sys
import bencode
import hashlib
import base64
import urllib
torrent_file = sys.argv[1]
torrent = open(torrent_file, 'r').read()
metadata = bencode.bdecode(torrent)
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select