Skip to content

Instantly share code, notes, and snippets.


Nicky Toh nickytoh

View GitHub Profile
dcalsky / BluetoothService.kt
Last active Jul 30, 2021
Bluetooth Service for Android with Kotlin
View BluetoothService.kt
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
import android.bluetooth.BluetoothSocket
import android.util.Log
import kotlinx.coroutines.*
import java.util.*
mayneyao / notion2blog.js
Last active Aug 2, 2021 > Personal Blog | custom domain + disqus comment
View notion2blog.js
const MY_DOMAIN = ""
const START_PAGE = ""
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
nrollr / nginx.conf
Last active Aug 3, 2021
NGINX config for SSL with Let's Encrypt certs
View nginx.conf
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
# SSL configuration
klzgrad /
Created Nov 17, 2014






ghabs / app.js
Created Apr 16, 2014
Express API tutorial
View app.js
var express = require('express');
var app = express();
var headlines = [
{ author : 'John Smith', text : "You will not believe what this child does next."},
{ author : 'Jane Doe', text : "It started as a protest, then turned into a party. Thats not even the interesting part."},
{ author : 'Alice Example', text : "Can we squeeze two hundred jellybeans in one package? Yah probably."},
{ author : 'Bob Allan', text : "This famous celebrity is opposed to something you are too."}
romannurik /
Created Feb 10, 2014
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
* Copyright 2014 Google Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
View uuid_v4.js
var crypto = require("crypto")
module.exports = function() {
var bytes = crypto.randomBytes(16)
bytes[6] &= 0x0f // 0000xxxx
bytes[6] += 0x40 // 0100xxxx
bytes[8] &= 0x3f // 00xxxxxx
bytes[8] += 0x80 // 10xxxxxx
songzhiyong / Android-ShareCompat
Created Dec 9, 2013
Android 利用ShareCompat Build模式分享内容
View Android-ShareCompat
.setText("I'm sharing!")
.setStream(Uri.parse(SharingSupportProvider.CONTENT_URI + "/foo.txt"))
jamesvnz / gcmcss.js
Created Sep 29, 2013
Sample node.js server code to implement an XMPP server that will integrate with Android's Google Cloud Messaging (GCM) "device to cloud" message functionality - CCS. This sample only receives upstream messages (i.e. from the device).
View gcmcss.js
var xmpp = require('node-xmpp');
//Set node-xmpp options.
//Replace with your projectID in the jid and your API key in the password
//The key settings for CCS are the last two to force SSL and Plain SASL auth.
var options = {
type: 'client',
jid: '',
password: 'XXXXXXXX',
port: 5235,
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active Apr 4, 2021
Steps to install a Comodo PositiveSSL certificate with Nginx.
View install-comodo-ssl-cert-for-nginx.rst

Setting up a SSL Cert from Comodo

I use as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert