Skip to content

Instantly share code, notes, and snippets.

View en9inerd's full-sized avatar
:octocat:
Coding just for fun

Vladimir Loskutov en9inerd

:octocat:
Coding just for fun
View GitHub Profile
@en9inerd
en9inerd / update-zig.sh
Last active October 17, 2024 02:43
Script to install/update Zig and ZLS
#!/bin/bash
# Define the target directory
if [ -n "$1" ]; then
# check if the specified directory exists
if [ ! -d "$1" ]; then
echo "Directory $1 does not exist."
exit 1
fi
TARGET_DIR=$1
[{"id":"5a7d710eff9ddb36","type":"tab","label":"Get new posts from blog","disabled":false,"info":"","env":[]},{"id":"5470137f70f4ca7a","type":"feedparse","z":"5a7d710eff9ddb36","name":"","url":"https://enginerd.io/feed.xml","interval":"15","ignorefirst":true,"x":200,"y":140,"wires":[["814eb66a93a3e2e8"]]},{"id":"814eb66a93a3e2e8","type":"html","z":"5a7d710eff9ddb36","name":"","property":"payload","outproperty":"paragraphs","tag":"p","ret":"html","as":"single","x":170,"y":260,"wires":[["9c52eb61bd7cdaa6"]]},{"id":"29eb8d41a3eb35c6","type":"function","z":"5a7d710eff9ddb36","name":"get summary","func":"const summary = [];\nconst cleanedUpPayload = msg.payload.replace(/\\n/g, '').trim();\nconst publishedPosts = (cleanedUpPayload) ? cleanedUpPayload.split(',') : [];\nlet readMore = false;\n\nif (publishedPosts.includes(msg.topic)) return [null, null];\n\nfor (let i = 0; i < msg.paragraphs.length; i++) {\n summary.push(msg.paragraphs[i]);\n if (msg.paragraphs[i].includes('<!--more-->')) {\n summary[i]
@en9inerd
en9inerd / index.js
Last active August 29, 2024 23:20
Memory Address Manipulator
// This script prompts the user to enter a memory address and either increments or decrements it, maintaining the format.
// It also saves the new address to a file for use in subsequent runs.
// Define the file path
const filePath = FileManager.local().documentsDirectory() + "/memory_address.txt";
// Read the last saved address or use a default address
let lastAddress;
if (FileManager.local().fileExists(filePath)) {
lastAddress = FileManager.local().readString(filePath);
@en9inerd
en9inerd / discovery.ts
Last active November 11, 2023 05:17
Dynamic module discovery using json5 and glob
import { access, readFile } from 'fs/promises';
import { join, resolve, dirname } from 'path';
import { TSConfig } from './types';
import { sync as globSync } from 'glob';
import { parse as parseJSON } from 'json5';
import { DiscoveryError } from './exceptions';
async function getRootAppDir(): Promise<string> {
const appDir = process.env.PWD;
if (appDir) {
@en9inerd
en9inerd / git_committer_replacer
Last active December 20, 2021 06:24
committer email fix
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "<old-email>" ];
then
GIT_COMMITTER_NAME="<name>";
GIT_AUTHOR_NAME="<name>";
GIT_COMMITTER_EMAIL="<noreply-email>";
GIT_AUTHOR_EMAIL="<noreply-email>";
git commit-tree "$@";
else
git commit-tree "$@";
@en9inerd
en9inerd / .zshrc
Last active April 12, 2024 01:54
tanner.terminal & .zshrc
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt append_history
setopt share_history
setopt inc_append_history
# Make ls use colors
export CLICOLOR=1
alias ls='ls -Fa'