Skip to content

Instantly share code, notes, and snippets.

@kirill578
kirill578 / App.tsx
Created October 17, 2023 16:58
xstate warn issue
import { useActor, useMachine } from "@xstate/react";
import React from "react";
import { createMachine, ActorRefFrom, sendParent } from "xstate";
export const id = "survey";
export const eventStoreId = "survey";
export type SurveyActorRef = ActorRefFrom<ReturnType<typeof createSurvey>>;
const staticConfig = {
id: "survey",
:100000000C9467070C9490070C9490070C9490073D
:100010000C9490070C9490070C94493B0C94900717
:100020000C9490070C9490070C9490070C94EF2A72
:100030000C9490070C9490070C9490070C949007E4
:100040000C9490070C9490070C94243B0C94F73A72
:100050000C9490070C9490070C9490070C949007C4
:100060000C9490070C949007040002000004000414
:100070000000040704040000040404000000000061
:100080000000040000000004000000000004000064
:100090000202000000020407000407070400000039
@kirill578
kirill578 / kan.js
Last active December 18, 2022 20:12
(async () => {
const getResolutions = async (m3u8url) => {
const options = {};
try {
const breakdown = await fetch(m3u8url).then(res => res.text());
const matches = breakdown.matchAll(/RESOLUTION=(\d+x\d+)\n(https:\/\/.*?m3u8)/g);
for (const match of matches) {
const [_, reso, url] = match;
options[reso] = url;
var topsort = function (hash) {
let nodes = (Object.values(hash));
let output = [];
let seen = new Set();
nodes.forEach(node => {
if (!seen.has(node)) {
dfs(node, seen, output)
}
export const luhn = (value: string) => {
let nCheck = 0;
let nDigit = 0;
let bEven = true;
const newValue = value.replace(/D/g, '');
for (let n = newValue.length - 1; n >= 0; n -= 1) {
const cDigit = newValue.charAt(n);
nDigit = parseInt(cDigit, 10);
@kirill578
kirill578 / double_luhn.py
Created October 5, 2021 16:43
double lohn barcode in python
# output:
# 100000000 -> A10000000086
# 100000001 -> A10000000164
# 100000002 -> A10000000242
# 100000003 -> A10000000320
# 100000004 -> A10000000407
# 100000005 -> A10000000575
def luhn_checksum(number):
total=0
@kirill578
kirill578 / double_luhn.vb
Created October 5, 2021 16:38
double luhn checksum barcode
' Output:
'100000000 -> A10000000086
'100000001 -> A10000000164
'100000002 -> A10000000242
'100000003 -> A10000000320
'100000004 -> A10000000407
'100000005 -> A10000000575
Module VBModule
alert('test');