Skip to content

Instantly share code, notes, and snippets.

View iki's full-sized avatar

Jan Killian iki

View GitHub Profile
#!/usr/bin/env python
from __future__ import print_function
import re
import os
import sys
import glob
LF = '\n'
@iki
iki / README.md
Last active December 12, 2021 08:50 — forked from othiym23/npm-upgrade-bleeding.sh
Update global top level npm packages

Update global top level npm packages

Problem

npm update -g updates all global packages and their dependencies, see npm/npm#6247.

Solution

  1. Either use the shell script or windows batch here instead.
@iki
iki / gulpfile.js
Last active January 18, 2019 16:38
generating API documentation from RAML specification using raml2html in gulp
'use strict';
var gulp = require('gulp');
var path = require('path');
var CWD = path.resolve('.');
var API_SPEC = path.resolve(CWD, '../api/api.raml');
var API_DEST = path.resolve(CWD, '../server/static/docs/api');
var API_HTML = 'index.html';
@iki
iki / vc.bat
Last active November 19, 2015 12:40
Visual Studio 10/11/14 environment setup for python, or node.js/node-gyp. Determines VS version and architecture, calls respective vcVarsAll.bat and sets vcTargetsPath if needed.
@echo off
setlocal enableextensions
::: echo === "%~f0" %* >&2
set vcArgs=%*
set vcVersions=14 11 10
call :poparg vcArgs vcVersions 10 10 %1 && shift
call :poparg vcArgs vcVersions 11 11 %1 && shift
@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==
@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 / Dockerfile
Last active April 20, 2020 09:20
Test volume mount in docker
FROM alpine
WORKDIR /data
COPY . .
CMD ls -l /data
@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:
# Format: https://git-scm.com/docs/gitignore#_pattern_format
*.json
*.yaml
.DS_Store
*.log
*.log.*
/.*/
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(