Skip to content

Instantly share code, notes, and snippets.

@SCdF
SCdF / certificate.pem
Created July 15, 2020 12:53
Gandi signing certificate
-----BEGIN CERTIFICATE-----
MIIF6TCCA9GgAwIBAgIQBeTcO5Q4qzuFl8umoZhQ4zANBgkqhkiG9w0BAQwFADCB
iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQw
OTEyMDAwMDAwWhcNMjQwOTExMjM1OTU5WjBfMQswCQYDVQQGEwJGUjEOMAwGA1UE
CBMFUGFyaXMxDjAMBgNVBAcTBVBhcmlzMQ4wDAYDVQQKEwVHYW5kaTEgMB4GA1UE
AxMXR2FuZGkgU3RhbmRhcmQgU1NMIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IB
DwAwggEKAoIBAQCUBC2meZV0/9UAPPWu2JSxKXzAjwsLibmCg5duNyj1ohrP0pIL
m6jTh5RzhBCf3DXLwi2SrCG5yzv8QMHBgyHwv/j2nPqcghDA0I5O5Q1MsJFckLSk
@SCdF
SCdF / CHANGELOG.md
Created January 28, 2019 10:52
changelog example

Changelog

...not yet released...

Released: 2019-01-28

@SCdF
SCdF / bug.md
Created January 10, 2019 09:48
CouchDB MacOS bug

1: no config is present

$ curl -X GET "http://admin:pass@localhost:5984/_node/$COUCH_NODE_NAME/_config/httpd/" | jq .
{
  "port": "5986",
@SCdF
SCdF / reduce.md
Last active June 6, 2018 13:56
Reduce why you so confusing

Reduce why you so confusing

I have a bunch of docs that like this:

{
    "_id": "some-report-id",
    "reported_date": 123456,
    "patient_id": "abc-123"
}
@SCdF
SCdF / index.html
Last active April 30, 2018 16:07
PouchDB view generation takes 2x+ as long with attachments
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Attachments make view generation slow in PouchDB</h1>
<p>(read the console for output)</p>
<button id="dothething">Do the thing</button>
@SCdF
SCdF / log.txt
Last active August 31, 2017 13:50
CouchDB2.1 compaction bug
[error] 2017-08-31T08:58:09.717403Z couchdb@localhost emulator -------- Error in process <0.253.0> on node 'couchdb@localhost' with exit value: {{badmatch,{error,enoent}},[{couch_compaction_daemon,abs_path,1,[{file,"src/couch_compaction_daemon.erl"},{line,526}]},{couch_compaction_daemon,free_space_rec,2,[{file,"src/couch_compaction_daemon.erl"},{line,517}]},{couch_compaction_daemon...
[error] 2017-08-31T08:58:09.718157Z couchdb@localhost <0.251.0> -------- gen_server couch_compaction_daemon terminated with reason: {compaction_loop_died,{{badmatch,{error,enoent}},[{couch_compaction_daemon,abs_path,1,[{file,"src/couch_compaction_daemon.erl"},{line,526}]},{couch_compaction_daemon,free_space_rec,2,[{file,"src/couch_compaction_daemon.erl"},{line,517}]},{couch_compaction_daemon,can_db_compact,2,[{file,"src/couch_compaction_daemon.erl"},{line,327}]},{couch_compaction_daemon,maybe_compact_db,3,[{file,"src/couch_compaction_daemon.erl"},{line,164}]},{couch_compaction_daemon,'-compact_loop/1-fun-0-',3,[{file,"s..."},..
[error] 2017-08-16T15:46:19.880967Z couchdb@localhost <0.31396.135> -------- rpc couch_db:update_docs/4 function_clause [{couch_att,flush_data,[<0.18240.135>,stub,{att,<<"static/manifest.json">>,<<"application/json">>,303,303,<<104,90,16,208,215,168,186,234,246,222,101,113,104,182,40,52>>,1,stub,identity}],[{file,"src/couch_att.erl"},{line,484}]},{couch_db,'-doc_flush_atts/2-lc$^0/1-0-',2,[{file,"src/couch_db.erl"},{line,1144}]},{couch_db,doc_flush_atts,2,[{file,"src/couch_db.erl"},{line,1144}]},{couch_db,'-update_docs/4-lc$^8/1-8-',2,[{file,"src/couch_db.erl"},{line,999}]},{couch_db,'-update_docs/4-lc$^7/1-7-',2,[{file,"src/couch_db.erl"},{line,998}]},{couch_db,update_docs,4,[{file,"src/couch_db.erl"},{line,998}]},{fabric_rpc,with_db,3,[{file,"src/fabric_rpc.erl"},{line,284}]},{rexi_server,init_p,3,[{file,"src/rexi_server.erl"},{line,139}]}]
[error] 2017-08-16T15:46:19.881319Z couchdb@localhost <0.29072.135> 868e70f023 req_err(2144292456) unknown_error : function_clause
[<<"chttpd_db:update_doc/4 L1001">
@SCdF
SCdF / random-quality-test.js
Created June 16, 2017 14:32
Attempting to work out which algorithm to use
var randomBytes = require('crypto').randomBytes;
var RANDOM_GENERATORS = {
'randomUInt8Crypto': function() {
return randomBytes(1).readUInt8();
},
'randomUInt8Old': function() {
return 0 | Math.random() * 256;
}
};
@SCdF
SCdF / main.rs
Created October 8, 2016 17:37
Hideous knockaround in rust
fn next_prime(given: &Vec<i32>) -> Option<i32> {
fn is_prime(given: &Vec<i32>, i: i32) -> bool {
given.iter().all(|&x| i % x != 0)
}
if let Some(next) = given.iter().last() {
let mut next = next + 1;
while !is_prime(given, next) {
next += 1;
@SCdF
SCdF / keybase.md
Created October 5, 2016 09:15
keybase.md

Keybase proof

I hereby claim:

  • I am scdf on github.
  • I am scdf (https://keybase.io/scdf) on keybase.
  • I have a public key ASAKl-URAtBD4HZHO_6e0zYOWs-qZ1wzdZfw64VZF7WibAo

To claim this, I am signing this object: