Skip to content

Instantly share code, notes, and snippets.

View huksley's full-sized avatar
🐈
Step on no pets

Ruslan Gainutdinov huksley

🐈
Step on no pets
View GitHub Profile
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const userAgent =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0";
const cookieJar = new jsdom.CookieJar();
const resources = new jsdom.ResourceLoader({
userAgent
@huksley
huksley / kiosk-install.sh
Last active March 6, 2025 13:13
Raspberry PI OS Lite configure kiosk - shows multiple web pages as chrome tabs and rotates between them
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install --no-install-recommends -y xserver-xorg xinit x11-xserver-utils
sudo apt-get install -y chromium-browser matchbox-window-manager xautomation unclutter xdotool
sudo tee /boot/kiosk.sh <<EOF
#!/bin/sh
xset -dpms # disable DPMS (Energy Star) features.
xset s off # disable screen saver
xset s noblank # don't blank the video device
@huksley
huksley / Chart.tsx
Last active October 28, 2021 06:58
Single component frappe-chart wrapper for react
/* eslint-disable @typescript-eslint/no-explicit-any */
import React, { useImperativeHandle, forwardRef } from "react";
import { Chart } from "frappe-charts/dist/frappe-charts.esm";
type ChartType = "line" | "bar" | "axis-mixed" | "pie" | "percentage" | "heatmap";
type AxisMode = "span" | "tick";
type ChartData = {
labels?: Array<string>;
@huksley
huksley / test.tsx
Last active July 6, 2021 07:21
Fully typed ReactJS CRUD example
import { useState } from "react";
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
export type Unsaved<T extends { _id: string; updatedAt: Date }> = Optional<
T,
"_id" | "updatedAt"
>;
interface User {
_id: string;
@huksley
huksley / hexspeak.js
Created June 10, 2021 17:06
hexspeak generator
const { customAlphabet } = require("nanoid");
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const deadbeef = [
"0ff1ce",
"10cc",
"1ce",
"ab1e",
"abad",
@huksley
huksley / mars-build.sh
Last active July 28, 2020 19:58
Mars build script
#!/bin/bash
set +x
if [ -d Mars ]; then
cd Mars
git pull
cd ..
else
git clone https://[email protected]/Magnum3D/Mars
fi
{
"Records": [
{
"messageId": "fec4fd9f-1a09-4449-8e1a-6e379dca4d2b",
"receiptHandle": "base64-encoded-something",
"body": "dasdsa",
"attributes": {},
"messageAttributes": {},
"md5OfBody": "7c1cadb6887373dacb595c47166bfbd9",
"eventSource": "aws:sqs",
2020-03-29T17:29:39.263Z d0892cf5-0a04-407e-ad9c-f07bda11623d WARN Error TypeError: argument must be a buffer
at Object.inspect (buffer.js:814:18)
at formatValue (internal/util/inspect.js:693:31)
at formatProperty (internal/util/inspect.js:1558:11)
at formatRaw (internal/util/inspect.js:933:9)
at formatValue (internal/util/inspect.js:721:10)
at inspect (internal/util/inspect.js:264:10)
at formatWithOptions (internal/util/inspect.js:1865:40)
at Object.format (internal/util/inspect.js:1695:10)
at Object.console.warn (/var/runtime/LogPatch.js:76:27)
git clone https://github.com/maasglobal/maas-tsp-example
cd maas-tsp-example
npm install
npm start
zbctl --address $CONTACTPOINT_ADDRESS:443 status \
--clientId $CLIENTID --clientSecret $CLIENTSECRET \
create instance Process_1j8gwvl --variables '{ "name": "John" }'
{
"workflowKey": 2251799813688076,
"bpmnProcessId": "Process_1j8gwvl",
"version": 1,
"workflowInstanceKey": 2251799813688081
}