Skip to content

Instantly share code, notes, and snippets.

View terjesb's full-sized avatar
🎯
Focusing

Terje Sten Bjerkseth terjesb

🎯
Focusing
View GitHub Profile
@terjesb
terjesb / meraki-client-vpn-linux.md
Created January 27, 2021 11:28 — forked from clivetyphon/meraki-client-vpn-linux.md
Configuring Meraki Client VPN in Linux

Configuring Meraki Client VPN in Linux

You can try the official Meraki Configuring Client VPN in Linux article for GUI based setup. For terminal based configuration, see below.

Install packages

Install the following packages:

  • strongswan
  • xl2tpd
@terjesb
terjesb / how.md
Created January 27, 2021 11:28 — forked from Zemnmez/how.md
L2TP / ipsec VPN, Amazon Linux (EC2)
# adapted from http://spottedhyena.co.uk/centos-67-ipsecl2tp-vpn-client-unifi-usg-l2tp-server/
yum -y install epel # different on amazon linux
sudo yum -y install xl2tpd openswan
systemctl start ipsec.service
service ipsec start

# 'myserver.com' is just to help identify. these are all imported into /etc/ipsec.conf.

vim /etc/ipsec.d/myserver.com.conf # see next...
@terjesb
terjesb / deps.edn
Created March 1, 2018 11:33
Pull Query
{:paths ["."]
:deps
{com.datomic/datomic-free {:mvn/version "0.9.5656"}}}
@terjesb
terjesb / translate.clj
Created October 9, 2017 12:16 — forked from robert-stuttaford/translate.clj
Language translations for Datomic entities with fallback to base entity
(ns cognician.db.translate
(:require [datomic.api :as d])
(:import [clojure.lang MapEntry]
[datomic.query EntityMap]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Language
(def default-language :en-GB)
@terjesb
terjesb / latency.txt
Created May 4, 2017 15:06 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@terjesb
terjesb / feed.clj
Created November 26, 2016 17:01 — forked from hlship/feed.clj
(def payment-codes-per-block 4096)
(defn create-payment-code-feed
[db]
(let [payment-code-feed (chan 10)]
(go-loop []
(let [block-id (allocate-block db)
block-start (* block-id payment-codes-per-block)]
(-> (onto-chan payment-code-feed
(->>

Keybase proof

I hereby claim:

  • I am terjesb on github.
  • I am terjesb (https://keybase.io/terjesb) on keybase.
  • I have a public key ASCs6Fb0IkKiaWnHlzmw-wss8s4NI5EUOs8k-wynxTREwgo

To claim this, I am signing this object:

@terjesb
terjesb / mock-connection.clj
Created December 9, 2015 20:01 — forked from vvvvalvalval/mock-connection.clj
Mocking datomic.Connection for fast in-memory testing
(ns bs.utils.mock-connection
"Utilities for using Datomic"
(:require [datomic.api :as d])
(:use clojure.repl clojure.pprint)
(:import (java.util.concurrent BlockingQueue LinkedBlockingDeque)
(datomic Connection)))
(defrecord MockConnection
[dbAtom, ^BlockingQueue txQueue]
@terjesb
terjesb / joda-transit.clj
Created December 2, 2015 14:36 — forked from casperc/joda-transit.clj
Joda DateTime handler for Transit
;; Adds support to Transit for emitting Joda DateTimes in the same format as standard java.util.Date.
;; Dependencies: [clj-time "0.9.0"] and [com.cognitect/transit-clj "0.8.259"] (newer version will likely still work)
(require '[cognitect.transit :as transit])
(require '[clj-time.coerce :as coerce])
(import '[java.io ByteArrayOutputStream])
(def ^:private joda-time-verbose-handler
(transit/write-handler
(use '[datomic.api :only [db q] :as d])
(def schema
[{:db/doc "A persons name"
:db/id #db/id[:db.part/db]
:db/ident :name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}