Skip to content

Instantly share code, notes, and snippets.

View junxie6's full-sized avatar
🐢
Push the limits of what's possible. Today.

Jun Hsieh junxie6

🐢
Push the limits of what's possible. Today.
View GitHub Profile
@junxie6
junxie6 / PersistentCookieStore.java
Last active November 11, 2016 03:08 — forked from lezorich/PersistentCookieStore.java
Android basic persistent cookie manager for Volley. This cookie store wraps the default CookieManager store to store the session cookie. It use's Gson to json serialize the cookie and store it as a json string in SharedPreferences.
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Lukas Zorich
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@junxie6
junxie6 / asymmetric.go
Created March 27, 2016 18:09 — forked from cryptix/LICENSE
example of using JWT for http authentication in go
package main
// using asymmetric crypto/RSA keys
import (
"crypto/rsa"
"fmt"
"io/ioutil"
"log"
"net/http"
@junxie6
junxie6 / golang-tls.md
Created March 27, 2016 18:23 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Generated private key

openssl genrsa -out server.key 2048

To generate a certificate

openssl req -new -x509 -key server.key -out server.pem -days 3650

https

@junxie6
junxie6 / multipart_upload.go
Created March 28, 2016 05:10 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@junxie6
junxie6 / dump.go
Last active April 21, 2020 19:29
run external command
package main
import (
"fmt"
"os"
"os/exec"
"path"
)
func main() {
@junxie6
junxie6 / check_os_type.go
Last active July 13, 2016 22:54
determine operating system type
package main
import (
"log"
"runtime"
)
// Reference: http://stackoverflow.com/questions/19847594/how-to-reliably-detect-os-platform-in-go
func main() {
log.Printf("%v\n", runtime.GOOS) // output windows or linux
@junxie6
junxie6 / debug_ajax.html
Last active July 14, 2016 16:42
ajax sample
<html>
<head>
<script src="/static/jqwidgets-ver4.1.2/scripts/jquery-2.2.4.min.js"></script>
<script>
$( document ).ready(function() {
var token = "";
// Global AJAX Configuration
$.ajaxSetup({
type: 'post',
@junxie6
junxie6 / Build_Vim7.4_CentOS7.txt
Last active August 24, 2021 18:10
Compile the latest Vim 7.4 on CentOS 7
Compile the latest Vim 7.4 on CentOS 7
# yum install gcc make ncurses ncurses-devel
# yum install ruby ruby-devel lua lua-devel luajit \
luajit-devel ctags git python python-devel \
python3 python3-devel tcl-devel \
perl perl-devel perl-ExtUtils-ParseXS \
perl-ExtUtils-XSpp perl-ExtUtils-CBuilder \
perl-ExtUtils-Embed
@junxie6
junxie6 / simplysdkanswerprompt.cs
Created August 9, 2016 17:05
Answer the prompt automatically in Simply SDK
/// <summary>
/// AskAlert expects a return value of AlertResult.YES or AlertResult.NO
/// </summary>
public override AlertResult AskAlert(SimplyMessage message)
{
Console.WriteLine(message.Message);
if ((new Regex(@"^You did not enter an amount on the invoice")).Match(message.Message).Success)
{
return AlertResult.YES;
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)