Skip to content

Instantly share code, notes, and snippets.

View HamGuy's full-sized avatar
🎯
Focusing

HamGuy HamGuy

🎯
Focusing
View GitHub Profile
@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
@staticfloat
staticfloat / NativeCameraInferface.cpp
Created February 6, 2013 13:08
Edited Nokia sample
#include "pch.h"
#include "NativeCameraInterface.h"
using namespace Microsoft::WRL;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Phone::Media::Capture;
// Called each time a preview frame is available
void NativeCameraInterface::Native::CameraCapturePreviewSink::OnFrameAvailable(
@sirleech
sirleech / gist:2660189
Created May 11, 2012 14:42
Python Read JSON from HTTP Request of URL
# Load Json into a Python object
import urllib2
import json
req = urllib2.Request("http://localhost:81/sensors/temperature.json")
opener = urllib2.build_opener()
f = opener.open(req)
json = json.loads(f.read())
print json
print json['unit']
@ksm
ksm / UINavigationController+Fade.h
Created February 14, 2012 22:23
UINavigationController custom pop/push transition animation
/*
Copied and pasted from David Hamrick's blog:
Source: http://www.davidhamrick.com/2011/12/31/Changing-the-UINavigationController-animation-style.html
*/
@interface UINavigationController (Fade)
- (void)pushFadeViewController:(UIViewController *)viewController;
- (void)fadePopViewController;
@interface UIImage (fixOrientation)
- (UIImage *)fixOrientation;
@end