Skip to content

Instantly share code, notes, and snippets.

View srghma's full-sized avatar

Serhii Khoma srghma

View GitHub Profile
@srghma
srghma / extension.bash
Created November 3, 2024 11:01
zed editor install extension locally script
#!/usr/bin/env bash
set -euo pipefail
# Configuration
EXTENSION_DIR="/home/srghma/projects/zed/extensions/idris2"
INSTALL_DIR="$HOME/.local/share/zed/extensions/installed/idris2"
CACHE_DIR="$HOME/.cache/zed/extensions"
CLANG_PATH="$HOME/.cache/zed/wasi-sdk/wasi-sdk-21.0/bin/clang" # Add clang path
@srghma
srghma / transmerge.sh
Created February 11, 2024 13:47 — forked from bathtime/transmerge.sh
A simple Linux shell script for translating an .srt file into another language and merging both languages into an .ass file
#!/bin/sh
#
# This program takes an .srt file, translates it, and merges both translations into a .ass file with the user's selected
# language on top of the screen and the other language at the bottom.
#
# Usage: ./transmerge.sh [source language] [target language] [language on top (en|fri|...)] [source .srt] [target .ass (optional)]
#
# ex., $ ./transmerge.sh en fr en movie.srt
#
// ==UserScript==
// @name etimologias.dechile.net
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://etimologias.dechile.net/?huella
// @icon https://www.google.com/s2/favicons?sz=64&domain=dechile.net
// @grant GM_addStyle
delete require.cache['/home/srghma/.node_modules/lib/node_modules/ebook-convert/index.js']
convert = require('/home/srghma/.node_modules/lib/node_modules/ebook-convert')
async function convertAsync(options) {
return new Promise((resolve, reject) => {
convert(options, function (error) {
if (error) { return reject(error) }
return resolve()
})
})
}

run geth using

geth --datadir ./myDataDir --dev --http --http.api web3,eth,debug,personal,net --http.corsdomain "https://remix.ethereum.org,http://remix.ethereum.org" --vmdebug

in https://remix.ethereum.org deploy contract

contract MyContract {
var R = require('ramda')
console.log(R.sortBy(R.prop(1), Object.entries(require('fs').constants)).map(([key, value]) => `${value.toString(2).padStart(21, '~')} ${key}`).join('\n'))
~~~~~~~~~~~~~~~~~~~~0 O_RDONLY
~~~~~~~~~~~~~~~~~~~~0 UV_DIRENT_UNKNOWN
~~~~~~~~~~~~~~~~~~~~0 UV_FS_O_FILEMAP
~~~~~~~~~~~~~~~~~~~~0 F_OK
~~~~~~~~~~~~~~~~~~~~1 UV_FS_SYMLINK_DIR
@srghma
srghma / test.purs
Last active February 25, 2022 17:05
purescript-coroutines
-- | 'guy state (start): { state: 0 }'
-- | 'appleTree state (start): { state: 0 }'
-- | 'appleTree state (1 put): { state: 1 }'
-- | 'guy awaitInput (1 await): { output: 1 }'
-- | 'guy state (1 get): { state: 1 }'
-- | 'appleTree state (1 emit): { state: 1 }'
-- | 'appleTree state (2 put): { state: 2 }'
-- | 'guy awaitInput (2 await): { output: 2 }'
-- | 'guy state (2 get): { state: 2 }'
-- | '(Tuple unit { state: 2 })'
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)
}
FFT
https://www.youtube.com/watch?v=spUNpyF58BY - Fourier Transform
You should find what is a freq of a signal (e.g. you should find that it's 3b/s)
you are given signal portion 4.5 s
you can wrap that 4.5 around a circle where
- 1 rotation per 6 seconds = 1/6 rotations per second
import * as React from 'react'
import { useState } from 'react'
import ReactDOM from 'react-dom'
import { StyledEngineProvider } from '@mui/material/styles'
import * as R from 'ramda'
import * as RA from 'ramda-adjunct'
import { useMIDI, useMIDIOutput } from '@react-midi/hooks'
// import { Pcset } from "@tonaljs/tonal"
//
// TODO: calculate Forte number