Skip to content

Instantly share code, notes, and snippets.

View Tymek's full-sized avatar

Tymoteusz Czech Tymek

View GitHub Profile
@Tymek
Tymek / gist:170c5e6f14f580c069a0d1bc71419095
Created January 16, 2023 19:13
ZSH - list colors for p10k (powerlevel10k)
for i in {0..255}; do print -Pn ' '%K{$i} %k%F{$i}${(l:3::0:)i}%f ' ' ${${(M)$((i%6)):#3}:+$'\n'}; done
version: '3'
services:
mysql:
image: docker.io/bitnami/mysql:8.0
volumes:
- ./mysql_data:/bitnami/mysql
environment:
- ALLOW_EMPTY_PASSWORD=yes
- MYSQL_USER=bn_wordpress
- MYSQL_DATABASE=bitnami_wordpress
@Tymek
Tymek / seed.ts
Last active May 25, 2022 08:45
Unleash features - seed db
const readline = require("readline");
const { default: faker } = require("@faker-js/faker");
require("isomorphic-fetch");
const API_URL = "http://localhost:4242/api/admin/projects/default/features";
const API_KEY = "<YOUR_ADMIN_TOKEN>";
const pastDate = (min = 0) => new Date(Date.now() - 1000 * 60 * min);
const FgGreen = "\x1b[32m";
@Tymek
Tymek / logo.svg
Created March 15, 2022 22:12
Shiftly
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Tymek
Tymek / script.js
Created March 12, 2022 18:02
Twitter to Nitter proxy – tampermonkey redirect
// ==UserScript==
// @name Twitter to Nitter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Tymek
// @match https://twitter.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
import { compile } from 'svelte/compiler'
/**
* @returns {import('vite').Plugin}
*/
const vitePluginSvelteDocs = () => {
const virtualModuleId = '@virtual:svelte-docs'
return {
name: 'vite-plugin-svelte-docs',
@Tymek
Tymek / vercel.json
Created April 16, 2021 07:46
Vercel Opt-out from Google's FLoC Network
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Permissions-Policy",
"value": "interest-cohort=()"
}
]
@Tymek
Tymek / useNavigationLock.ts
Last active May 25, 2023 22:38
Next.js block navigation on unsaved changes
import { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
/** Ask for confirmation before changing page or leaving site.
*
* @see https://git.io/JOskG
*/
const useNavigationLock = (
isEnabled = true,
warningText = 'You have unsaved changes – are you sure you wish to leave this page?',
@Tymek
Tymek / headless-pi.sh
Last active March 8, 2021 20:21
Headless Raspbian setup – WiFi and SSH
#!/bin/bash
clear
echo ""
echo -e "\e[44mHEADLESS RASPBIAN\e[0m"
echo "WiFi & SSH setup"
echo ""
echo "Available partitions:"
lsblk -e7
echo ""
@Tymek
Tymek / sortImagesByAspectRatio.py
Last active January 27, 2021 23:04
Sort images by aspect ratio with Python and exiftool
#!/usr/bin/env python3
import sys
import os
import glob
import subprocess
import multiprocessing as mp
import subprocess
# change this
inputDir = "./input"