Skip to content

Instantly share code, notes, and snippets.

View coldnew's full-sized avatar
💭
I may be slow to respond.

Yen-Chin,Lee coldnew

💭
I may be slow to respond.
View GitHub Profile
@coldnew
coldnew / get-docker.sh
Created July 17, 2022 10:44 — forked from DaveMDS/get-docker.sh
Install docker on arm64 synology
#!/bin/bash
set -e
ARCH=aarch64
DOCKER_VERSION=20.10.9
COMPOSE_VERSION=2.5.1
DOCKER_DIR=/volume1/@docker
echo "Downloading docker $DOCKER_VERSION-$ARCH"
curl "https://download.docker.com/linux/static/stable/$ARCH/docker-$DOCKER_VERSION.tgz" | tar -xz -C /usr/local/bin --strip-components=1
@coldnew
coldnew / epubs2t_opencc.py
Created March 16, 2018 01:24 — forked from yen3/epubs2t_opencc.py
Convert epub content from simple chinese to traditional chinese using OpenCC (https://code.google.com/p/opencc/)
#!/usr/bin/env python
#-*- coding: utf8 -*-
from __future__ import print_function
from optparse import OptionParser
import zipfile
from sys import argv, exit
from subprocess import Popen, PIPE, check_output
import os.path
@coldnew
coldnew / direct_vpn.md
Created November 4, 2017 01:44 — forked from b4284/direct_vpn.md
Get Instant VPN Using Tor and OpenVPN for Computers Behind Firewalls

Get Instant VPN Using Tor and OpenVPN for Computers Behind Firewalls

Scenario

Both computers are behind firewall and NAT, and both has direct access to the Internet.

Steps

Step 1: Computer A

  1. Install curl, Tor, OpenSSH and OpenVPN.
  2. Setup Tor, a Hidden Service, and SSH server. That is, having these lines in your Tor configuration file (usually /etc/tor/torrc):

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats. The link points back at them.

If you are talking about the aspect of pattern matching that acts as a conditional based upon structure, I'm not a big fan. I feel about them the way I do about switch statements - they're brittle and

Connecting to serial port (com port) over network

(Serial port or com port? - Serial ports are often refered as COM ports. It is the same to be short. You can read abut it in the Wiki article )


## The problem Suppose we have an application that works with some device using serial port (com port). It could be GPS reader, IRDA, whatever. So it looks like this:
@coldnew
coldnew / docker-zfs.md
Created November 23, 2016 01:13 — forked from marksteve/docker-zfs.md
Use ZFS Docker storagedriver
  1. Create ZFS pool

sudo zpool create -f zroot /dev/sdaX

  1. Create ZFS dataset

sudo zfs create -o mountpoint=/var/lib/docker zroot/docker

  1. Edit /etc/defaults/docker
@coldnew
coldnew / http-shim.cljs
Created November 17, 2016 05:34 — forked from moea/http-shim.cljs
Get, e.g. cljs-http or any goog.net.XmlHttp-based client working on Node
(ns ...
(:import [goog.net XmlHttp XmlHttpFactory])
(:require [cljs.nodejs :as nodejs]))
(def xml-http-request
(-> (nodejs/require "xmlhttprequest")
(.. -XMLHttpRequest)))
(defn NodeXhrFactory []
(this-as this (.call XmlHttpFactory this)))
@coldnew
coldnew / google-api.clj
Created November 7, 2016 01:49 — forked from arohner/google-api.clj
Clojure example of accessing google APIs directly
(ns example.api.google
(:require [cemerick.url :as url]
[cheshire.core :as json]
[clj-jwt.core :as jwt]
[clj-jwt.key :as key]
[clj-time.core :as time]
[clj-http.client :as http]
[clojure.string :as str])
(:import java.io.StringReader))
@coldnew
coldnew / es7coreasync.md
Created November 5, 2016 13:08 — forked from shaunlebron/es7coreasync.md
es7 vs core.async

Comparing ES7 and core.async

ES7 core.async
async function() {...} (fn [] (go ...))
await ... (<! ...)
await* or Promise.all(...) (doseq [c ...] (<! c))
@coldnew
coldnew / jetty-clojure.md
Created November 2, 2016 06:44 — forked from karanth/jetty-clojure.md
Notes on installing SSL certificates in jetty - clojure + ring

SSL is an important security and privacy feature for all websites. Its details are outlined in this wikipedia [article] ("http://en.wikipedia.org/wiki/Secure_Sockets_Layer"). At Scibler, we use SSL certificates, encrypting all traffic to and fro from our servers. SSL is a public-key based asymmetric encryption scheme for symmetric key exchange. Symmetric keys are used for payload encryption. On our servers, we use embedded jetty (ring jetty adapter), with the clojure [ring] (https://github.com/ring-clojure) library to handle the http specific functionality.

This is a tutorial about installing SSL certificates on jetty webservers. SSL certificates are X.509 certificates that can be self-signed (authorized by Scibler) or can be signed by trusted third-parties. Trusted third-party certificates are the ones that a Internet user and browsers trust the most. Trusted third-party certification authorities issue certificates per domain and charge a nominal yearly fee.

####Pre-Requisites

  • The Java JDK has to be