- https://www.iteratorshq.com
This file contains hidden or 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
javascript:(async()=>{const e=await miro.board.getSelection(),t=e=>e?e.replace(/<br\s*\/?>/gi,"\n").replace(/<\/p>\s*<p>/gi,"\n").replace(/<\/?[^>]+(>|$)/g,"").replace(/&[#a-z0-9]+;/gi,"").trim():"",n=e.filter(e=>"connector"!==e.type).map(e=>({id:e.id,type:e.type,text:t(e.content||e.title||""),shape:e.shape,x:e.x,y:e.y})),o=[...n].sort(((e,t)=>e.y-t.y||e.x-t.x)),a=[...n].sort(((e,t)=>e.x-t.x||e.y-t.y)),r=e.filter(e=>"connector"===e.type).map(e=>({from:e.start?.item,to:e.end?.item,arrow:"none"!==e.style?.endStrokeCap})).filter(e=>e.from&&e.to),c={nodes:Object.fromEntries(n.map(e=>[e.id,{text:e.text,type:e.type,shape:e.shape,x:e.x,y:e.y}])),edges:r},l={};for(const e of r)e.arrow&&((l[e.from]=l[e.from]||[]).push(e.to));function d(e,t=new Set){if(t.has(e))return null;t.add(e);const n=c.nodes[e];return n?{id:e,text:n.text,type:n.type,children:(l[e]||[]).map(e=>d(e,t)).filter(Boolean)}:null}const i=new Set(r.filter(e=>e.arrow).map(e=>e.to)),s=n.map(e=>e.id).filter(e=>!i.has(e)),f=s.map(e=>d(e)).filter(Boolean),u=%6 |
This file contains hidden or 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
from pydantic import BaseModel, model_validator, ValidationError | |
import json | |
from typing import Any | |
class JsonModel(BaseModel): | |
""" | |
A base model that parses the entire input or specific fields if they contain JSON strings. | |
""" | |
@model_validator(mode="before") |
This file contains hidden or 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
#command that says battery low if <8% | |
ioreg -l |awk 'BEGIN{FS="=";max=0;cur=0;} $1~/CurrentCapacity/{cur=$2} $1~/MaxCapacity/{max=$2} END{if (cur/max*100<8) {"say battery low" | getline result} else {print "battery OK"}}' | |
#crontab editor | |
crontab -e | |
#crontab entry that does this once every 60s | |
* * * * * ioreg -l |awk 'BEGIN{FS="=";max=0;cur=0;} $1~/CurrentCapacity/{cur=$2} $1~/MaxCapacity/{max=$2} END{if (cur/max*100<8) {"say battery low" | getline result} else {print "battery OK"}}' |
This file contains hidden or 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
uploadify() { | |
echo "echo '"${$(cat $1 | base64)}${$(echo "' | base64 --decode > $1")} | |
} | |
#usage uploadify logo.png | |
#copy + paste on any terminal anywhere in the interwebs |
This file contains hidden or 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
# find icloud files | |
cd $HOME/Library/Mobile Documents/com~apple~CloudDocs | |
# test run crontab | |
find $HOME/Library/Mobile\ Documents/com\~apple\~CloudDocs -type d -name node_modules -exec touch {}/.nosync \; | |
# add crontab with vim so it runs every couple of hours | |
EDITOR=vim crontab -e | |
0 */2 * * * find $HOME/Library/Mobile\ Documents/com\~apple\~CloudDocs -type d -name node_modules -exec touch {}/.nosync \; |
This file contains hidden or 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
#We're creating a nginx + a ECHO SERVER | |
# in nginx we play around the config | |
# echo server will show us the WYMIWYG (WHAT YOU MEAN IS WHAT YOU GET) when we do requests to the nginx | |
# run containers for debug | |
docker run --detach --name nginx -p 80:80 nginx | |
docker run --detach --name echo -P jmalloc/echo-server | |
# enter the server | |
docker exec -ti nginx bash |
This file contains hidden or 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
# ./p.bin is /opt/docker/p.bin | |
# 1 is the PID of java | |
jmap -dump:format=b,file=./p.bin 1 | |
docker cp <containerId>:/file/path/within/container /host/path/target | |
docker cp <containerId>:/opt/docker/p.bin . | |
scp -o StrictHostKeyChecking=no -i $(echo $ssh_private_key_location) user@example.com:/home/core/p.bin . |
This file contains hidden or 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
$(cat package.json | grep "version" | sed 's/.*"\(.*\)".*/\1/') | |
or | |
$(node -p "require('./package.json').version") | |
if you have node (not the case for some docker images) |
This file contains hidden or 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
$(cat build.sbt | grep '[ \t]*version :=' | sed 's/.*"\(.*\)".*/\1/') |
This file contains hidden or 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
list files | |
docker ps -a | |
commit data to images | |
docker commit 91ea7799154c user/test_image1 | |
docker commit e68f87d44923 user/test_image2 | |
docker commit 439177e1f838 user/test_image3 | |
docker commit 1fbf94e114ff user/test_image4 |
NewerOlder