Skip to content

Instantly share code, notes, and snippets.

@dejanb
dejanb / mesh-test.md
Last active February 8, 2024 15:41
Test Bluetooth mesh

start clean mesh (first terminal):


$ rm -rf ~/.config/meshcfg/config_db.json
$ sudo rm -rf /var/lib/bluetooth/mesh
$ sudo mkdir /var/lib/bluetooth/mesh
$ sudo /usr/libexec/bluetooth/bluetooth-meshd -nd --debug

provisioner (second terminal):

@navidshaikh
navidshaikh / crc_setup.txt
Last active January 30, 2020 16:20
Get CRC running on local machine
1 - Get CRC:
https://github.com/code-ready/crc/releases
excerpts:
Downloads are available at:
https://mirror.openshift.com/pub/openshift-v4/clients/crc/1.4.0/ .
To use these binaries, please follow the instructions at https://cloud.redhat.com/openshift/install/crc/installer-provisioned
to obtain the needed pull-secret.
(download the pull-secret in your machine in a file)
2 - Extract the tar downloaded (there is a crc binary in there, add the extracted dir to your $PATH)
@cemerick
cemerick / gist:6cc2a276f34177ebf52b
Created March 9, 2015 17:46
quartz scheduling job name / key leak
; CIDER 0.6.0alpha (package: 0.5.0) (Clojure 1.6.0, nREPL 0.2.3)
=> (schedule #(println "foo"))
=> (schedule #(println "foo"))
=> (schedule #(println "foo"))
...
=> (def s (immutant.scheduling.internal/scheduler {}))
#<Var@5f67764a:
#<QuartzScheduling org.projectodd.wunderboss.scheduling.QuartzScheduling@450109d4>>
; scheduled job names (and thus their JobKeys) are retained, even if they're not repeating
#!/bin/bash
IN="LVDS1"
EXT="HDMI3"
if (xrandr | grep "$EXT disconnected"); then
xrandr -d :0.0 --output $IN --auto --output $EXT --off
else
xrandr -d :0.0 --output $IN --auto --output $EXT --auto --right-of $IN --primary
fi
(ns my.cache.listener
(:require [immutant.cache :as c])
(:import org.infinispan.notifications.Listener
[org.infinispan.notifications.cachelistener.annotation
CacheEntryCreated CacheEntryModified CacheEntryRemoved]))
(definterface Handler (^void handle [event]))
(deftype ^{Listener true}
Monitor []
(require 'compile)
(defun locate-all-dominating-files (dir filename)
"Searches for FILENAME in DIR and its parents, returning a list
of all dirs containing the file."
(let ((found-dir (locate-dominating-file (expand-file-name dir) filename)))
(if found-dir
(cons found-dir (locate-all-dominating-files
(concat found-dir "..")
filename)))))
; CIDER 0.6.0alpha (package: 20140316.1007) (Clojure 1.5.1, nREPL 0.2.3)
user> (.maxMemory (Runtime/getRuntime))
103284736
user> (require '[clojure.java.io :as io])
nil
user> (with-open [f (io/writer "/tmp/foo")] (doseq [x (range 50000)] (.write f (prn-str [x (range 1000)]))))
nil
user> (.length (io/file "/tmp/foo"))
194988890
user> (slurp "/tmp/foo")
[jim@thinky poorsmatic]$ for i in $(rhc app show --gears | sed '1,2 d' | cut -d ' ' -f 6); do echo "HOST: $i"; ssh $i jstat -gcutil $\(jps -l \| grep jboss-modules \| awk \'{print \$1}\'\); done
HOST: 5203f3cae0b8cd0552000935@poorsmatic-jimi.rhcloud.com
S0 S1 E O P YGC YGCT FGC FGCT GCT
49.59 0.00 63.45 85.27 99.90 54 7.798 1 2.828 10.626
HOST: 52040513500446daa5000c2c@52040513500446daa5000c2c-jimi.rhcloud.com
S0 S1 E O P YGC YGCT FGC FGCT GCT
0.00 0.00 100.00 99.16 99.88 1110 140.653 194 568.457 709.110
HOST: 52040513500446daa5000c2d@52040513500446daa5000c2d-jimi.rhcloud.com
S0 S1 E O P YGC YGCT FGC FGCT GCT
0.00 45.88 98.27 89.67 99.87 55 8.342 1 2.471 10.813
<subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="tcp">
<stack name="tcp">
<transport type="TCP" socket-binding="jgroups-tcp"/>
<!-- Use S3_Ping because we need to discover the IPs of
the other nodes, and AWS doesn't have multicast. -->
<protocol type="S3_PING">
<property name="secret_access_key">topsy</property>
<property name="access_key">krets</property>
@xeqi
xeqi / pallet.clj
Last active December 14, 2015 23:39
immutant and pallet
(require
'[pallet.crate.git :refer [git clone]]
'[pallet.crate.java :refer [java]]
'[pallet.crate.lein :refer [lein leiningen]])
(def repo "git://github.com/jcrossley3/random-apps-of-kindness.git")
(def demo-directory "random-apps-of-kindness/demo")
(defplan setup-machine