Skip to content

Instantly share code, notes, and snippets.

View jcf's full-sized avatar
❤️

James Conroy-Finn jcf

❤️
View GitHub Profile
@jcf
jcf / checkpoint.sh
Last active March 4, 2024 18:38 — forked from bubenkoff/checkpoint.sh
Endpoint Security VPN FULL start/stop script for Mac OS X
#!/bin/bash
# Toggle Checkpoint VPN firewall and VPN client
#
# http://git.io/vWAPU
set -e
APP='/Applications/Endpoint Security VPN.app'
KEXT='/System/Library/Extensions/cpfw.kext'
PLIST='/Library/LaunchDaemons/com.checkpoint.epc.service.plist'
SERVICE='com.checkpoint.epc.service'
@jcf
jcf / readme.md
Created July 31, 2012 13:56
Git Commit Style Guide

Writing Commit Messages

Structure your commit message like this:

One line summary (less than 50 characters)

Longer description (wrap at 72 characters)
@jcf
jcf / AAA-README.md
Created August 15, 2021 18:02 — forked from jackrusher/AAA-README.md
Clojure + FUSE

Meld

A minimal example of creating a (mostly) working FUSE filesystem using Clojure. NOTE: I have only tested this with OSX, and it assumes you have already installed libfuse.

Trying it out

Create an empty directory at /tmp/meld to serve as your mount point, put these files in a directory called meld, then:

@jcf
jcf / Moving ActiveRecord Errors.rb
Created September 17, 2009 10:52
Copy errors on an ActiveRecord object in to another instance's errors
# cat, dog = Cat.new, Dog.new
# cat.friends << dog
# cat.save
# => false
# cat.errors
# #<ActiveRecord::Errors ... @errors={"dog" => "is not valid"}>
# cat.errors << dog.errors
# cat.errors
# #<ActiveRecord::Errors ... @errors={"dog" => "is not valid", "bark" => "is not bigger than bite"}
@jcf
jcf / log.clj
Created September 4, 2016 11:22
Refresh logback.xml from a Clojure REPL
(ns app.log
(:require [clojure.java.io :as io])
(:import ch.qos.logback.classic.joran.JoranConfigurator
ch.qos.logback.classic.LoggerContext
org.slf4j.LoggerFactory))
(defn reload-logback
[]
(let [context ^LoggerContext (LoggerFactory/getILoggerFactory)
configurator (JoranConfigurator.)
@jcf
jcf / chromium-profile-3.desktop
Created April 24, 2020 17:34
Chromium "desktop" with explicit profile
[Desktop Entry]
Version=1.0
Name=Chromium
Exec=/usr/bin/chromium --profile-directory='Profile 3' %U
StartupNotify=true
Terminal=false
Icon=chromium
Type=Application
Categories=Network;WebBrowser;
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/ftp;x-scheme-handler/http;x-scheme-handler/https;
@jcf
jcf / sync.sh
Last active April 19, 2020 09:32
Parallel rsync script
#!/usr/bin/env zsh
# Usage:
#
# sync.sh
set -ex
# Number of rsync processes to run
n=10
# Remote host address
@jcf
jcf / retry.clj
Created May 27, 2015 13:13
core.async retry
(ns com.example.util
(:import [clojure.core.async.impl.channels ManyToManyChannel])
(:require [clojure.core.async :as async]))
(defn retry
[f & {:keys [out-ch retries delay]}]
{:pre [(and (integer? retries) (pos? retries))
(integer? delay)
(instance? ManyToManyChannel out-ch)]}
@jcf
jcf / myapp.yml
Created January 7, 2020 12:42
Test your Clojure project with test-runner, clj-kondo and GitHub's actions!
---
name: myapp
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
@jcf
jcf / test.clj
Last active September 7, 2019 04:51
Measure slow clojure.test tests, and pretty print them
;; Make sure to require this file before you run your tests, and after any other
;; library that uses the same clojure.test hooks.
;;
;; NOTE: This doesn't work if you run your tests with `lein difftest`.
(ns example.test
(:require [clojure.pprint :refer [print-table]]
[clojure.test :refer [report with-test-out]]))
(def ^:private ^:const slow "in seconds"
0.1)