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
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
volume=70 | |
speakers="192.168.2.103 192.168.2.60" | |
for host in $speakers; do | |
echo $host | |
# enable optical direct mode | |
curl -s http://$host/opticaldirect/enabled -XPOST | |
# name must be Left or Right | |
curl -s http://$host/device/name | jq . | |
role=$(curl -s http://$host/device/name | jq -r .data.name) | |
curl -s http://$host/opticaldirect/role -d "{\"role\":\"Front$role\"}" -H "Content-Type: application/json" |
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
package main | |
import ( | |
"context" | |
"flag" | |
"os" | |
"os/exec" | |
"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" | |
"go.uber.org/cadence/activity" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
while true | |
do | |
if ping -c 1 -w 3 192.168.2.67 &> /dev/null || hcitool scan | grep -q -E "ming-macbook|Ming's iPhone" ; then | |
echo "welcome back. turning screen on" | |
echo 0 | sudo tee /sys/class/backlight/rpi_backlight/bl_power | |
else | |
echo "you're gone. turning screen off" | |
echo 1 | sudo tee /sys/class/backlight/rpi_backlight/bl_power |
NewerOlder