Skip to content

Instantly share code, notes, and snippets.

View patcon's full-sized avatar

Patrick Connolly patcon

View GitHub Profile
@patcon
patcon / crowdwisdom--8wmbcdmfdr--math-pca2.json
Created May 28, 2024 13:23
Response from /math/pca2/ endpoint for Plural Research Experiment
{
"n": 41,
"pca": {
"comps": [
[0, 0, 0, 0, 0, 0, 0.0982148134063051, -0.0395807796201572, 0.0255458342902308, 0.0895542461578575, 0.0622362593020714, 0.0619847040322527, 0.0691659447132596, 0.132839572974422, 0.199116266094196, 0.0877755063873693, 0.141321085541321, 0.0887043117571917, 0.0259982179280277, 0.0373454637465944, 0, -0.025292261486439, 0.00390422243208681, 0.119963903854036, 0.12183511443554, 0.0509043107490715, 0.16281524349036, 0.0351953221274216, 0.177136920144061, 0.126486569445845, 0.129170606878865, -0.0276735756465717, 0.0345244656915796, -0.00144753935700808, 0.0684443120602143, 0.0602725121802336, 0.104940656909645, 0.0724048053635653, 0.0629474871408984, 0.188782282222489, -0.0185361114541214, 0.0745405648144721, 0.13705733251262, 0.0587340591007566, 0.0592251108993003, -0.00925521718545387, 0.0659799958311654, 0.192416249592286, 0.00856904080215316, 0.187016573782286, 0.0208855127296274, 0.133429980427884, -0.0456214094636508, 0.021289825295605, 0.0189938244404089, 0.2339
@patcon
patcon / 01--README.md
Last active April 17, 2024 18:00
How to display the assigned cluster group ID to a user in the pol.is wrapper app

The browser knows the xid since we generate/assign it in the wrapper app (even if it's just stored in localstorage and never goes to a server).

Using the xid provided in url query param, we can get user details, including the conversation-specific participant ID in .ptpt.pid (see attached for full response)

https://pol.is/api/v3/participationInit?conversation_id=4kjz5rrrfe&pid=mypid&xid=12334552

https://gist.github.com/patcon/d0f8fec0f11c969a5cd9e0ab282f8cb1#file-02-4kjz5rrrfe-participationinit-xid-12334552-json-L23

// snip
{
"liveblocksType": "LiveObject",
"data": {
"mode": "active",
"clappingHandsReactions": {
"liveblocksType": "LiveList",
"data": [
{
"uid": "92d3c9fd-b9a8-4721-a029-e0fd88e5f0bc",
"at": "1695539736755",
$ docker-compose run --rm maintenance bash setup.sh
Creating gc-digital-talent_maintenance_run ... done
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 0 installs, 4 updates, 0 removals
- Downloading monolog/monolog (2.6.0)
- Downloading league/commonmark (2.3.1)
- Downloading laravel/framework (v8.83.12)
- Downloading laravel/sail (v1.14.4)
- Upgrading monolog/monolog (2.5.0 => 2.6.0): Extracting archive
const fs = require('fs');
const ssri = require('ssri');
const path = require('path');
const npmCachePath = process.env.npm_config_cache;
// Get this from npmjs? Not cache?
let integritySha512 = 'sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=='
let packageName = 'get-caller-file';
let packageVersion = '2.0.5';
@patcon
patcon / 1-terminal.log
Created March 8, 2022 19:13
git bisect to find broken commit
$ git bisect start 2043-lint-fixes f4fcef97cecbefb7a4c1fcfda3f4bcaf553fa88c
# known good: f4fcef97cecbefb7a4c1fcfda3f4bcaf553fa88c
# known bad: 2043-lint-fixes
$ git bisect run bash 1-bisect-test.sh
>>> stdout
[...]
ef5a3f2504e72647af0526a6af093672e65f7a4a is the first bad commit
commit ef5a3f2504e72647af0526a6af093672e65f7a4a
Author: Patrick Connolly <patrick.c.connolly@gmail.com>
Date: Sun Feb 20 23:29:58 2022 -0500
This file has been truncated, but you can view the full file.
[
{
"statusCode": 200,
"type": "rpc",
"tid": 3,
"ref": false,
"action": "MapPageController",
"method": "remoteSearch",
"result": [
{
@patcon
patcon / StaticXFA2AcroForm.java
Created October 16, 2020 00:42 — forked from JoelGeraci-Datalogics/StaticXFA2AcroForm.java
This Gist will convert a Static XFA Form to an AcroForm by removing the XFA dictionary.
/*
* Copyright Datalogics, Inc. 2015
*/
package pdfjt.cookbook.forms;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
@patcon
patcon / script.sh
Last active June 17, 2020 19:57
Small script to find any strings in js/strings/en.js that are not used in client-participation codebase.
cd client-participation/js/strings/
cat en.js \
| grep '^ ' \
| cut -d '"' -f2 \
| xargs -E $'\n' sh -c 'for arg do echo "$arg"; git grep "s\.$arg" ../../ \
| cat; done' > used-strings.log
diff --git a/server/package-lock.json b/server/package-lock.json
index f3d300fa..c4b26bb5 100644
--- a/server/package-lock.json
+++ b/server/package-lock.json
@@ -224,6 +224,11 @@
}
}
},
+ "abbrev": {
+ "version": "1.1.1",