Skip to content

Instantly share code, notes, and snippets.

@ipbastola
ipbastola / jq to filter by value.md
Last active March 28, 2024 10:04
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@Daan-Grashoff
Daan-Grashoff / google_search_maps_addon.js
Last active March 28, 2024 10:03
Bring back the google maps button when searching on google
// ==UserScript==
// @name Google maps addon
// @namespace http://tampermonkey.net/
// @version 2024-03-21
// @description Bring google maps button back
// @author You
// @match https://www.google.com/search*
// @include https://www.google.tld/search*
// @icon https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png
// @grant none
@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 10:03
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@pR0Ps
pR0Ps / make-wg-client.sh
Last active March 28, 2024 10:01
Script to generate wireguard configs for clients to allow them to connect to the local wireguard server
#!/bin/bash
#######
# Setup
#######
### Enable IPv4/6 forwarding:
# # In /etc/sysctl.d/30-ipforward.conf :
# net.ipv4.ip_forward=1
# net.ipv6.conf.default.forwarding=1
# net.ipv6.conf.all.forwarding=1
{
"attributes": {
"referrals": null,
"miscarriages": 19,
"notes": [],
"form": {
"id": "9b5716fd-a0bb-47d6-bf23-68b18acc0195",
"type": "medical:form"
},
"room": null,
@pesterhazy
pesterhazy / building-sync-systems.md
Last active March 28, 2024 10:00
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@Yrlish
Yrlish / cf-worker-proton-wkd.js
Last active March 28, 2024 09:59
CloudFlare worker proxy for ProtonMail WKD
// 1. Create a worker in the dashboard and paste the following code into it
// 2. Replace all references to example.com to your domain, add more domains if needed
// 3. Deploy the worker
// 4. Setup routes in the dashboard for:
// - example.com/.well-known/openpgpkey/*
// - openpgpkey.example.com/.well-known/openpgpkey/*
// - (apply above for additional domains too)
// 5. Verify that it is working with https://metacode.biz/openpgp/web-key-directory
export default {