Skip to content

Instantly share code, notes, and snippets.

View zhiguangwang's full-sized avatar

Zhiguang Wang zhiguangwang

View GitHub Profile
@zhiguangwang
zhiguangwang / GameViewController.m
Created June 4, 2015 03:52
Game Center authentication with third party server.
#pragma mark - GameKit related stuff
// See documentation:
// https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/Users/Users.html#//apple_ref/doc/uid/TP40008304-CH8-SW17
// Call this method in (void)viewDidAppear:(BOOL)animated
- (void) authenticateLocalPlayer {
[GKLocalPlayer localPlayer].authenticateHandler = ^(UIViewController *viewController, NSError *error) {
if (viewController != nil) {
[self showAuthenticationDialog: viewController];
@zhiguangwang
zhiguangwang / openssl.md
Last active December 6, 2021 03:37
Common OpenSSL Commands with Keys and Certificates

Common OpenSSL Commands with Keys and Certificates

Generate RSA private key (2048 bit)

openssl genrsa -out private.pem 2048

Generate a Certificate Signing Request (CSR)

openssl req -sha256 -new -key private.pem -out csr.pem
@zhiguangwang
zhiguangwang / codedeploy.md
Last active August 28, 2022 07:05
Deal with CodeDeploy ApplicationStop failure with AWS CLI.

Use the --ignore-application-stop-failures option with the AWS CLI tool while doing the deployment:

aws deploy create-deployment --application-name APPLICATION --deployment-group-name GROUP --ignore-application-stop-failures --s3-location bundleType=tar,bucket=BUCKET,key=KEY --description "Ignore ApplicationStop failures due to broken script"
@zhiguangwang
zhiguangwang / download-oracle-jdk.md
Last active January 28, 2016 02:48
Download Oracle JDK via CLI with license bypass.
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" [DOWNLOAD-URL]

Example: download JDK 8u66 for Mac OS X

wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-macosx-x64.dmg
@zhiguangwang
zhiguangwang / websocket-elb.md
Last active April 23, 2019 20:23
Configure websockets behind an AWS ELB.
@zhiguangwang
zhiguangwang / mono-certmgr.md
Last active September 7, 2018 17:42
Manage SSL Certificates for Mono with Certificate Manager.

Manage SSL Certificates for Mono with Certificate Manager

For more details, see certmgr.

Note for commands to work, certificate must be in DER format.

Valid certificate store names are:

  • Trust (ROOT CA)
  • CA (Intermediate CA)
@zhiguangwang
zhiguangwang / maven-runnable-jar-with-libraries.md
Created November 10, 2015 02:41
Packages maven project as runnable jar and library jars.

##Desired file hierarchy

Run mvn clean package expects the following layouts:

target folder layout

target
├── ${project.artifactId}-${project.version}
│   ├── lib

│   │   ├── jersey-bean-validation-2.22.1.jar

@zhiguangwang
zhiguangwang / elasticbeanstalk-elb-idle-timeout-cli.md
Created November 24, 2015 14:49
Update ELB Idle Timout AWS Elastic Beanstalk via CLI.
aws elasticbeanstalk update-environment \
    --environment-name [environment-name] \

--option-settings \ Namespace=aws:elb:policies,OptionName=ConnectionSettingIdleTimeout,Value=[timeout-seconds]

@zhiguangwang
zhiguangwang / pptp-intranet-route.md
Last active January 27, 2016 07:01
Shell scripts for bypassing PPTP VPN with intranet IP addresses (Mac OS X).

Add shell scripts

Add the following scripts under /etc/ppp/ (requires root privilege):

common

#!/bin/sh

# add/delete route only if device is in a specific intranet IP address block,
@zhiguangwang
zhiguangwang / README.md
Last active April 29, 2024 12:56
Installing and running shadowsocks on Ubuntu Server

Installing and running shadowsocks on Ubuntu Server

16.10 yakkety and above

  1. Install the the shadowsocks-libev package from apt repository.

     sudo apt update
     sudo apt install shadowsocks-libev
    
  2. Save ss.json as /etc/shadowsocks-libev/config.json.