Skip to content

Instantly share code, notes, and snippets.

@udkyo
udkyo / Dockerfile
Last active September 6, 2025 05:56
Basic container for X11 forwarding goodness
FROM ubuntu
RUN apt update \
&& apt install -y firefox \
openssh-server \
xauth \
&& mkdir /var/run/sshd \
&& mkdir /root/.ssh \
&& chmod 700 /root/.ssh \
&& ssh-keygen -A \
&& sed -i "s/^.*PasswordAuthentication.*$/PasswordAuthentication no/" /etc/ssh/sshd_config \
@mfikes
mfikes / add-lib.md
Last active May 22, 2020 20:37
add-lib from ClojureScript

Alex Miller's new add-lib capability, hacked into ClojureScript:

deps.edn:

{:deps {org.clojure/clojurescript {:git/url "https://github.com/mfikes/clojurescript"
                                   :sha "4fa9edd736d47b8ef5648b61b199e64ef80735bb"}
        org.clojure/tools.deps.alpha {:git/url "https://github.com/clojure/tools.deps.alpha.git"
                                      :sha "d492e97259c013ba401c5238842cd3445839d020"}}}
@yogthos
yogthos / README.md
Created August 27, 2017 07:39
ClojureScript Planck FFI example
@danielgomezrico
danielgomezrico / .gitlab-ci.yml
Last active June 16, 2020 11:47
Android / Gitlab ci - sample setup files to setup your own local gitlab runner with real physical android devices. Check https://github.com/caipivara/awesome-android-scripts
stages:
- build
- test
- deploy
variables:
GIT_STRATEGY: clone
cache:
key: ${CI_PROJECT_ID}
@danielgomezrico
danielgomezrico / .gitlab-ci.yml
Last active April 26, 2018 14:54
Gitlab - Local Gitlab Runner for Android (setup your computer with real usb attached devices)
stages:
- build
- test
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/
before_script:
@pjullah
pjullah / mysql.clj
Last active September 6, 2017 14:50
Working with MySQL in boot
(boot.core/merge-env! :dependencies '[[org.clojure/java.jdbc "x.y.z"][mysql/mysql-connector-java "x.y.z"]])
(require '[clojure.java.jdbc :as sql])
(def db-host "127.0.0.1")
(def db-port 3306)
(def db-name "cmdb")
(def db-user "root")
(def db-password "my-secret-pw")
@jaycobbcruz
jaycobbcruz / Permutations.java
Last active February 16, 2022 09:20
Find all permutations of given items using Java 8
public class Permutations {
public static <T> Stream<Stream<T>> of(final List<T> items) {
return IntStream.range(0, factorial(items.size())).mapToObj(i -> permutation(i, items).stream());
}
private static int factorial(final int num) {
return IntStream.rangeClosed(2, num).reduce(1, (x, y) -> x * y);
}
@cjbarre
cjbarre / twitter_signed_multi_part_post_request_example.clj
Last active December 14, 2019 13:49
Example: Send A Signed Multi-Part Media HTTP POST Request With Clojure | Clojure, Twitter API, media/upload, OAuth 1.0, multipart/form-data, Authorization, Signed Request
;; Example: Send A Signed Multi-Part Media HTTP POST Request With Clojure
;;
;; Keywords: Clojure, Twitter API, media/upload, OAuth 1.0, multipart/form-data, Authorization, Signed Request
;;
;; Dependencies: [clj-http "2.2.0"] [clj-oauth "1.5.5"]
;;
;; Description:
;; The code is meant to read well as an example, not be idiomatic or efficiently organized.
;;
;; I am leaving the raw materials here, put it together how you'd like it!
@halgari
halgari / word-count.clj
Created March 2, 2017 23:57
Word Count (MMap)
;; On my box, wc processes the 11GB JSON file in 50sec
;; This code does it in 11sec
;; Compiled with lein uberjar, and run with java -server -jar word-count-STANDALONE.jar
(ns word-count.core
(:import (java.io RandomAccessFile File)
(java.nio.channels FileChannel$MapMode)
(java.nio ByteBuffer))
(:gen-class))
(ns sunshine.disk-read
(:require [clojure.core.async :as async :refer [>! <! go-loop chan close! <!!]]])
(:import (java.io BufferedReader FileReader FileInputStream BufferedInputStream InputStreamReader)))
(def ten-gb-filename "ten.json")
(def one-meg (* 1024 1024))
(defn ^FileInputStream input-stream [^String fname]
(FileInputStream. fname))