Skip to content

Instantly share code, notes, and snippets.

View ardumont's full-sized avatar

Antoine R. Dumont ardumont

View GitHub Profile
# default session will start xmonad
xsession = {
enable = true;
windowManager = {
xmonad = {
enable = true;
enableContribAndExtras = true;
extraPackages = self: [
self.xmobar self.xmonad-contrib
];
@ardumont
ardumont / sd-image-rpi4.nix
Last active November 11, 2019 08:58
nixos: build rpi4 sd-image
# To build, use:
# For https://github.com/NixOS/nixpkgs/pull/68265: works (building image
# though)
# NIXPKGS_HOME=$HOME/repo/public/nixpkgs
# NIXPKGS_CONFIG=$HOME/repo/private/nixos/rpi4/sd-image-rpi4.nix
# NIX_PATH="nixpkgs=$NIXPKGS_HOME" \
# nix-build '<nixpkgs/nixos>' -I nixos-config=$NIXPKGS_CONFIG -A config.system.build.sdImage
# For: https://github.com/NixOS/nixpkgs/pull/70796: does not work with uboot yet
@ardumont
ardumont / server.conf
Created October 1, 2016 11:06 — forked from laurenorsini/server.conf
OpenVPN configuration for /etc/openvpn/server.conf
local 192.168.2.0 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
dev tun
proto udp #Some people prefer to use tcp. Don't change it if you don't know.
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Server.crt # SWAP WITH YOUR CRT NAME
key /etc/openvpn/easy-rsa/keys/Server.key # SWAP WITH YOUR KEY NAME
dh /etc/openvpn/easy-rsa/keys/dh1024.pem # If you changed to 2048, change that here!
server 10.8.0.0 255.255.255.0
# server and remote endpoints
@ardumont
ardumont / MakeOpenVPN.sh
Last active October 1, 2016 11:37 — forked from laurenorsini/MakeOpenVPN.sh
MakeOpenVPN.sh by Eric Jodoin
#!/bin/bash
# Default Variable Declarations
DEFAULT="Default.txt"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".3des.key"
CA="ca.crt"
TA="ta.key"

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

package scalawebapp
import com.sun.net.httpserver.{HttpExchange, HttpHandler, HttpServer}
import java.net.InetSocketAddress
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{Failure, Success}
class MyHttpServer(port: Int = 8080) {
@ardumont
ardumont / datomic-first-steps.clj
Created November 25, 2012 19:30 — forked from noahlz/datomic-first-steps.clj
First steps with Datomic
;; adopted from http://www.datomic.com/company/resources/getting-started
;; Clojure 1.4.0
;; user=>
(use '[datomic.api :only [q db] :as d])
;;=> nil
;; user=>
(doc d/q)
;; -------------------------
@ardumont
ardumont / clojure-match.clj
Created September 6, 2012 06:56 — forked from cgrand/clojure-match.clj
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
@ardumont
ardumont / blink-letter.clj
Created June 20, 2012 20:23
blink a led in morse according to a letter
@ardumont
ardumont / launch-hello-world-from-repl.clj
Created June 5, 2012 21:26
launch the hello world from the repl
(def device-board "/dev/ttyACM0")
;; this is a limitation on the underlying lib clodiuno uses. Indeed, it searches only for /dev/ttySxx serial devices
;; and on ubuntu GNU/Linux it's named /dev/ACM0
(System/setProperty "gnu.io.rxtx.SerialPorts" device-board)
;; now declaring the board
(def board (arduino :firmata device-board))
;; the led must be set in output mode