Skip to content

Instantly share code, notes, and snippets.

View xpe's full-sized avatar

David James xpe

View GitHub Profile
@xpe
xpe / deploy
Last active August 29, 2015 13:57
I use this script to build a WAR file (from a Clojure Pedestal app)
#!/usr/bin/env bash
set -e # exit on failure
[ -n "$DEBUG" ] && set -x # turn on command echo
# --------------
# Step 4: Deploy
# --------------
# Consult the documentation of your web container to find out how to deploy an
@xpe
xpe / project.clj
Created March 29, 2014 16:29
Example project.clj for Clojure web app using Pedestal and Datomic
(defproject myapp-service "0.0.2-SNAPSHOT"
:description "A web app"
:url "http://myapp.domain.com"
:dependencies
[[org.clojure/clojure "1.6.0"]
[org.clojure/tools.reader "0.8.3"]
[com.datomic/datomic-pro "0.9.4699"
:exclusions [org.slf4j/slf4j-api org.slf4j/slf4j-nop commons-codec]]
[io.pedestal/pedestal.service "0.2.2"
:exclusions [com.fasterxml.jackson.core/jackson-core]]
@xpe
xpe / start-riak
Created October 24, 2014 03:42
Adjusts ulimit, as needed, and starts Riak on Mac OS X. Tested on Yosemite.
#!/usr/bin/env bash
MAXFILES=$(launchctl limit maxfiles | sed -e 's/[[:space:]]+/ /g' | xargs)
if [ "$MAXFILES" != "maxfiles 65536 65536" ]; then
set -x
sudo launchctl limit maxfiles 65536 65536
fi
set -x
ulimit -n 65536
riak start
@xpe
xpe / iterate-until-stable-alternatives.clj
Last active August 29, 2015 14:13
Clojure: iterate-until-stable
;; gfredericks on IRC
(defn repeat-until-stable
[f x]
(->> (iterate f x)
(partition 2 1)
(filter (fn [[x1 x2]] (= x1 x2)))
ffirst))
;; amalloy on IRC
(defn repeat-until-stable
(ns grime-dice
(:require
[clojure.pprint :refer [print-table]]))
(def dice
{:red [4 4 4 4 4 9]
:yellow [3 3 3 3 8 8]
:blue [2 2 2 7 7 7]
:magenta [1 1 6 6 6 6]
:olive [0 5 5 5 5 5]})
@xpe
xpe / artifactory-project.clj
Created March 18, 2015 02:15
Example Artifactory project.clj for Leiningen 2.5
;; To deploy to a hosted Artifactory server:
(defproject project-name "0.1.0-SNAPSHOT"
;; ...
:deploy-repositories
[["releases"
{:url "http://org-name.artifactoryonline.com/org-name/libs-releases-local"
:username :env/artifactory_user
:password :env/artifactory_pass}]
["snapshots"
{:url "http://org-name.artifactoryonline.com/org-name/libs-snapshots-local/"

Keybase proof

I hereby claim:

  • I am xpe on github.
  • I am xpe (https://keybase.io/xpe) on keybase.
  • I have a public key whose fingerprint is 20A0 61E7 8CA2 CB1C F61E 1E6D 476A 4D08 42F3 F12A

To claim this, I am signing this object:

pub struct PairSet<T> {
a: T,
b: T,
}
impl<T> PairSet<T> where T: Eq {
/// If the values are different, creates a `PairSet` with them.
pub fn new(x: T, y: T) -> Option<PairSet<T>> {
if x == y {
None
@xpe
xpe / nvidia-persistenced-service-permission-error.md
Created March 19, 2018 17:50
NVIDIA persistenced permission error

I noticed this in my syslog:

Mar 19 08:23:23 ralph systemd[1]: Configuration file /lib/systemd/system/nvidia-persistenced.service is marked executable. Please remove executable permission bits. Proceeding anyway.

I corrected the permissions with:

sudo chmod -x /lib/systemd/system/nvidia-persistenced.service
@xpe
xpe / default-terminal-in-ubuntu-gnome.md
Last active March 19, 2018 18:08
Changing the default terminal in Gnome (Ubuntu 17.10)

I'm running Ubuntu 17.10.

After I installed Terminator, it became the default terminal in Gnome.

I would like to switch back to the default terminal.

First, I checked:

gsettings get org.gnome.desktop.default-applications.terminal exec