This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Row Level Security Using JWT | |
-- Based on https://www.enterprisedb.com/blog/application-users-vs-row-level-security | |
-- and https://docs.postgrest.org/en/v12/explanations/db_authz.html | |
-- as admin user | |
-- create test tables | |
DROP TABLE IF EXISTS chat CASCADE; | |
CREATE TABLE chat | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem | |
chmod 600 id_rsa.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function f(body) { | |
const code = ` | |
with(this){ | |
return(async function(){ | |
${body} | |
}).call(this) | |
} | |
` | |
return new Function(code) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import child_process from 'child_process'; | |
function spawnPromise(cmd, args, options) { | |
return new Promise(function (resolve, reject) { | |
const process = child_process.spawn(cmd, args, options); | |
process.on('close', function (code) { | |
resolve(code); | |
}); | |
process.on('error', function (err) { | |
reject(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTENSION IF NOT EXISTS age; | |
LOAD 'age'; | |
SET search_path = ag_catalog, "$user", public; | |
-- Apache AGE load_sql | |
CREATE OR REPLACE FUNCTION public.load_sql(query agtype) RETURNS SETOF agtype AS $$ | |
BEGIN | |
RETURN QUERY EXECUTE FORMAT($sql$ | |
WITH query AS (%s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTENSION IF NOT EXISTS age; | |
CREATE EXTENSION IF NOT EXISTS pg_trgm; | |
LOAD 'age'; | |
SET search_path = ag_catalog, "$user", public; | |
-- Apache AGE graph_search | |
CREATE OR REPLACE FUNCTION public.graph_search(graph agtype, label agtype, property agtype, search agtype) RETURNS SETOF agtype AS $$ | |
DECLARE | |
fts TEXT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Computes the suggested PG count similar to this http://ceph.com/pgcalc/ | |
#Reguirements: | |
# - must run on ceph admin | |
# - depends on awk, wc and bc commands | |
#Limitations: | |
# - Assumes same OSD# for all pools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export SRC="10.0.4.5:5000" | |
export DEST="10.0.4.5:6000" | |
curl -s http://${SRC}/v2/_catalog | jq .repositories[] | xargs -I {} \ | |
skopeo sync \ | |
--src-tls-verify=false --src docker --src-creds ${DOCKER_USER}:${DOCKER_PASS} \ | |
--dest-tls-verify=false --dest docker --dest-creds ${DOCKER_USER}:${DOCKER_PASS} \ | |
${SRC}/{} ${DEST} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import {onDestroy, onMount} from "svelte" | |
export let component | |
let container | |
let root | |
onMount(async ()=> { | |
const {createRoot} = await import('react-dom/client') | |
const {createElement} = await import('react') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.mozilla.javascript.Context; | |
import org.mozilla.javascript.Function; | |
import org.mozilla.javascript.NativeObject; | |
import org.mozilla.javascript.Scriptable; | |
import org.mozilla.javascript.commonjs.module.Require; | |
import org.mozilla.javascript.commonjs.module.RequireBuilder; | |
import org.mozilla.javascript.commonjs.module.provider.SoftCachingModuleScriptProvider; | |
import org.mozilla.javascript.commonjs.module.provider.UrlModuleSourceProvider; | |
import java.io.File; |
NewerOlder