Skip to content

Instantly share code, notes, and snippets.

David James xpe

  • Berkeley, CA
Block or report user

Report or block xpe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@xpe
xpe / project.clj
Created Mar 29, 2014
Example project.clj for Clojure web app using Pedestal and Datomic
View project.clj
(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 / deploy
Last active Aug 29, 2015
I use this script to build a WAR file (from a Clojure Pedestal app)
View deploy
#!/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 / start-riak
Created Oct 24, 2014
Adjusts ulimit, as needed, and starts Riak on Mac OS X. Tested on Yosemite.
View start-riak
#!/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 Aug 29, 2015
Clojure: iterate-until-stable
View iterate-until-stable-alternatives.clj
;; 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
View grime-dice.clj
(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 Mar 18, 2015
Example Artifactory project.clj for Leiningen 2.5
View artifactory-project.clj
;; 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/"
View keybase.md

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:

View pair_set.rs
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 Mar 19, 2018
NVIDIA persistenced permission error
View nvidia-persistenced-service-permission-error.md

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 Mar 19, 2018
Changing the default terminal in Gnome (Ubuntu 17.10)
View default-terminal-in-ubuntu-gnome.md

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
You can’t perform that action at this time.