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
# time-format %T | |
# date-format %d/%b/%Y | |
# log_format %h %^[%d:%t %^] "%r" %s %b "%R" "%u" %T %^ | |
( cat /var/log/nginx/access.log | |
for i in /var/log/nginx/access.log.*.gz | |
do | |
sudo gunzip -c $i | |
done | |
) \ |
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 PIL import Image | |
import tempfile | |
import os | |
from math import ceil, sqrt | |
# import argparse | |
imgpath = input('What is the path to the image? ') | |
img = Image.open(imgpath) | |
img_width = img.size[0] | |
img_height = img.size[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
#!/usr/bin/env python3 | |
""" | |
files created using (this was redacted partially): | |
```sh | |
NODE='/home/mike/.local/share/pnpm/node' | |
for args in "--sampleCase1Arg"; | |
do | |
for file in input1 input2 input3 |
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
for i in {1..2}; | |
do | |
echo "Run $i" | |
date | |
gdb node -ex 'python gdb.events.exited.connect(lambda t: t.exit_code == 0 and gdb.execute("q"))' \ | |
-ex "run script.js --options 2>&1 > run_$i.log" \ | |
|| echo "failed $?"; | |
done |
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
ltrace -e "$(grep -h 'linkage_macro' $(find thirdparty_lib -name '*.h') | grep -v '^#' | cut -d' ' -f 3 | paste -sd+)@*my-so*" node script.js |
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
//! parser for nodelang written in zig | |
pub const Tok = enum { | |
colon, | |
other, // need at least two here to trigger it | |
}; | |
const Token = struct { | |
tok: Tok, | |
str: []const u8, |
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
import { useAsyncInterval } from "@bentley/react-hooks"; | |
//... | |
useAsyncInterval( | |
async ({isStale, setCancel}) => { | |
const aborter = new AbortController(); | |
setCancel(() => aborter.abort()); | |
const response = await fetch("http://localhost:3001/tank-params", { signal: aborter.signal }); | |
const result = await response.json(); | |
if (!isStale()) setTankParamValue(result[tankParamType]); | |
}, |
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
// at the top add these imports | |
import TankMarker from "./TankMarker.tsx"; | |
import { Viewer } from "@bentley/itwin-viewer-react"; | |
import { IModelJsViewProvider } from "@bentley/imodel-react-hooks"; | |
const App = () => {//... | |
//... at the bottom of the file replace the return statement with this | |
const [imjsInited, setImjsInited] = useState(false); | |
const [tankParamType, setTankParamType] = useState<"level" | "pressure">("level"); |
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
import React from "react"; | |
import { Marker } from "@bentley/imodel-react-hooks"; | |
import { useAsyncInterval } from "@bentley/react-hooks"; | |
import { Point3d } from "@bentley/geometry-core"; | |
export default function TankMarker({tankParamType}: {tankParamType: "level" | "pressure"}) { | |
const [tankParamValue, setTankParamValue] = React.useState<number>(); | |
useAsyncInterval( | |
async ({ isStale, setCancel }) => { |
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
yarn add express@^4.16.0 cors @bentley/imodel-react-hooks @bentley/react-hooks | |
node src/server.js |
NewerOlder