Skip to content

Instantly share code, notes, and snippets.

View iki's full-sized avatar

Jan Killian iki

View GitHub Profile
@iki
iki / .env
Last active August 27, 2024 05:35
tsx include dotfile issue reproduction
TEST_VAR=7
@iki
iki / README.md
Last active November 7, 2023 08:50
Simple DevOps shell library for Linux/Mac/Windows

Simple DevOps shell library for Linux/Mac/Windows

Usage: devops [options] <command> [args]

Sourcing:
  Sourcing script defines functions and passes entrypoint function to init.

  Samples when devops is located in the same/relative/absolute path:
    . "`dirname "${BASH_SOURCE[0]}"`/devops" && init <entrypoint> "$@"
@iki
iki / README.md
Last active April 26, 2023 10:08
Select list items in React
@iki
iki / curry.ts
Last active August 24, 2022 12:39
Dynamic function arguments currying in TypeScript
// Dynamic function arguments currying in TypeScript
// - For functions with any fixed arguments it keeps currying the function
// until all fixed arguments are provided, then returns the result
// - For functions with dynamic arguments only it keeps currying the function
// as long as the call provides any spices, otherwise returns the result
// - Source: https://gist.github.com/iki/6472c0775cc0847fc667c01524cafa6b
type Args = readonly unknown[]
type Func<A extends Args = any[], R = any> = (...args: A) => R
type Slices<A extends Args, I extends Args = []> = A extends readonly [infer F, ...infer R]
const hide = (s: string) => '*'.repeat(s.length);
const hideEachSecondMatch = (_match: string, ...matches: string[]) =>
matches
.slice(0, -2)
.map((m, i) => (i % 2 ? hide(m) : m))
.join('');
// Hide all characters in email name, except first and last character
// FIXME: Better hide at least one character for 1-2 character names
const hideEmail = (email: string, options?: { domain?: boolean }) =>
email.replace(
# Format: https://git-scm.com/docs/gitignore#_pattern_format
*.json
*.yaml
.DS_Store
*.log
*.log.*
/.*/
@iki
iki / docker-compose.yml
Created September 15, 2019 20:12
Docker-compose nginx CORS proxy
version: '3.7'
services:
whoami:
image: jwilder/whoami
ports:
- 127.0.0.1:7000:8000
cors:
@iki
iki / Dockerfile
Last active April 20, 2020 09:20
Test volume mount in docker
FROM alpine
WORKDIR /data
COPY . .
CMD ls -l /data
@iki
iki / .gitignore
Last active May 13, 2021 17:41
Example of using GraphQL API from Micropython with ported Prisma python-graphql-client
# See https://help.github.com/ignore-files/ for more about ignoring files.
# logs
*.log*
# tools settings and other hidden directories
/.*/
@iki
iki / Medium: remove location hash.user.js
Last active December 25, 2017 20:31 — forked from azu/Medium: remove location hash.user.js
Medium: remove location hash
// ==UserScript==
// @name Medium: remove location hash
// @namespace http://efcl.info/
// @description Remove location hash from medium
// @include https://medium.com/*
// @include https://uxdesign.cc/*
// @version 1
// @grant none
// ==/UserScript==