Skip to content

Instantly share code, notes, and snippets.

View tleyden's full-sized avatar

Traun Leyden tleyden

  • Indie Hacker (formerly Databricks)
  • Munich, Germany
  • X @tleydn
View GitHub Profile
@tleyden
tleyden / gist:cab86d77cbd9eae08799
Created January 23, 2015 01:11
go pprof on headlesss box
(pprof) web
Total: 6962 samples
Dropping nodes with <= 34 samples; edges with <= 6 abs(samples)
Loading web page file:////tmp/EmBAQVn6Kr.0.svg
Can't exec "/etc/alternatives/gnome-www-browser": No such file or directory at /usr/lib/go/pkg/tool/linux_amd64/pprof line 743.
Can't exec "/etc/alternatives/x-www-browser": No such file or directory at /usr/lib/go/pkg/tool/linux_amd64/pprof line 743.
Can't exec "google-chrome": No such file or directory at /usr/lib/go/pkg/tool/linux_amd64/pprof line 743.
Can't exec "firefox": No such file or directory at /usr/lib/go/pkg/tool/linux_amd64/pprof line 743.
Could not load web browser.
(pprof) quit
@tleyden
tleyden / gist:4b0f84e3edc41c2d0f78
Created January 21, 2015 20:38
possible approach - move validation out of transaction
public void forceInsert(RevisionInternal rev, List<String> revHistory, URL source) throws CouchbaseLiteException {
// TODO: in the iOS version, it is passed an immutable RevisionInternal and then
// TODO: creates a mutable copy. We should do the same here.
// TODO: see github.com/couchbase/couchbase-lite-java-core/issues/206#issuecomment-44364624
RevisionInternal winningRev = null;
boolean inConflict = false;
String docId = rev.getDocId();
@tleyden
tleyden / gist:f346749f649e9495a870
Created January 19, 2015 21:06
SQLiteDatabase nested transaction behavior test case
public void testNestedSQLTransactionRollback() throws Exception {
String schema = "CREATE TABLE docs ( " +
" doc_id INTEGER PRIMARY KEY, " +
" val TEXT UNIQUE NOT NULL); ";
LiteTestContext context = new LiteTestContext();
String dbName = "testNestedSQLTransactionRollback" + System.currentTimeMillis();
String path = context.getFilesDir() + File.separator + dbName + Manager.DATABASE_SUFFIX;
SQLiteDatabase sqlDatabase = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.CREATE_IF_NECESSARY);
// Set the username and password for the cluster. The same as calling:
// $ couchbase-cli cluster-init ..
//
// Docs: http://docs.couchbase.com/admin/admin/REST/rest-node-set-username.html
func (c CouchbaseCluster) ClusterInit(ip, adminUsername, adminPass string) error {
client := &http.Client{}
endpointUrl := fmt.Sprintf("http://%v:%v/settings/web", ip, COUCHBASE_PORT)
public void testNestedSQLTransactionRollback() throws Exception {
String schema = "CREATE TABLE docs ( " +
" doc_id INTEGER PRIMARY KEY, " +
" val TEXT UNIQUE NOT NULL); ";
LiteTestContext context = new LiteTestContext();
String dbName = "testNestedSQLTransactionRollback" + System.currentTimeMillis();
String path = context.getFilesDir() + File.separator + dbName + Manager.DATABASE_SUFFIX;
SQLiteDatabase sqlDatabase = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.CREATE_IF_NECESSARY);
@tleyden
tleyden / gist:3706e040167390d080c9
Created January 15, 2015 16:49
couchbase server not running: tree
hbase]# tree
.
├── bin
│   ├── cbbackup
│   ├── cbbrowse_logs
│   ├── cbcollect_info
│   ├── cbdump-config
│   ├── cbenable_core_dumps.sh
│   ├── cbepctl
│   ├── cbhealthchecker
@tleyden
tleyden / gist:ec9aa280d57692aee9df
Created January 15, 2015 16:47
couchbase running server tree
.
├── bin
│   ├── cbbackup
│   ├── cbbrowse_logs
│   ├── cbcollect_info
│   ├── cbdump-config
│   ├── cbenable_core_dumps.sh
│   ├── cbepctl
│   ├── cbhealthchecker
│   ├── cbrecovery
@tleyden
tleyden / gist:58e76b9a8e7af9d21d1e
Created January 14, 2015 22:28
journalctl --no-pager -u etcd
core@core-01 ~ $ journalctl --no-pager -u etcd
-- Logs begin at Tue 2014-12-16 16:24:47 UTC, end at Wed 2015-01-14 19:54:09 UTC. --
Dec 16 16:24:55 core-01 systemd[1]: Starting etcd...
Dec 16 16:24:55 core-01 systemd[1]: Started etcd.
Dec 16 16:24:55 core-01 etcd[833]: [etcd] Dec 16 16:24:55.533 INFO | The path /var/lib/etcd/log is in btrfs
Dec 16 16:24:55 core-01 etcd[833]: [etcd] Dec 16 16:24:55.534 INFO | Set NOCOW to path /var/lib/etcd/log succeeded
Dec 16 16:24:55 core-01 etcd[833]: [etcd] Dec 16 16:24:55.535 INFO | Discovery via https://discovery.etcd.io using prefix /6b8801383f271ad52e96fc90f570adb8.
Dec 16 16:24:55 core-01 etcd[833]: [etcd] Dec 16 16:24:55.809 INFO | Discovery _state was empty, so this machine is the initial leader.
Dec 16 16:24:55 core-01 etcd[833]: [etcd] Dec 16 16:24:55.809 INFO | Discovery fetched back peer list: []
Dec 16 16:24:55 core-01 etcd[833]: [etcd] Dec 16 16:24:55.810 INFO | 0f26e50a64dd4941b622e7f0bdc82929 is starting a new cluster
@tleyden
tleyden / gist:c9d66137956094edc9e6
Created January 14, 2015 00:27
logs, puller only. logs cleared before updating the object on my ios device.
01-14 00:25:21.484 D/Sync ( 4347): changeTrackerReceivedChange: {seq=59956, id=0b5f114f-e665-48a5-8cc8-62f60c97ab7c, changes=[{rev=6-71ece6cf8bc860653b6e5690d0f1263d}]}
01-14 00:25:21.484 D/Sync ( 4347): com.couchbase.lite.replicator.PullerInternal@52990b88: adding rev to inbox {0b5f114f-e665-48a5-8cc8-62f60c97ab7c #6-71ece6cf8bc860653b6e5690d0f1263d}
01-14 00:25:21.484 V/Sync ( 4347): com.couchbase.lite.replicator.PullerInternal@52990b88: changeTrackerReceivedChange() incrementing changesCount by 1
01-14 00:25:21.484 V/Sync ( 4347): com.couchbase.lite.replicator.PullerInternal@52990b88: Incrementing changesCount count from 812 by adding 1 -> 813
01-14 00:25:21.484 V/Sync ( 4347): com.couchbase.lite.replicator.PullerInternal@52990b88: addToInbox() called, rev: {0b5f114f-e665-48a5-8cc8-62f60c97ab7c #6-71ece6cf8bc860653b6e5690d0f1263d}. Thread: Thread[CBLManagerWorkExecutor,5,main]
01-14 00:25:21.484 V/Sync ( 4347): com.couchbase.lite.replicator.PullerInternal@52990b88: addToInbox() calling u