Skip to content

Instantly share code, notes, and snippets.

View Tymek's full-sized avatar

Tymoteusz Czech Tymek

View GitHub Profile
@Tymek
Tymek / Dockerfile
Last active December 15, 2018 14:31
Composer in Docker with signature verification
FROM php
RUN apt-get update
# Install Composer
# @see https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
ARG COMPOSER_URL="https://raw.githubusercontent.com/composer/getcomposer.org/d3e09029468023aa4e9dcd165e9b6f43df0a9999/web/installer"
ARG COMPOSER_SIGNATURE="93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8"
RUN php -r "copy(getenv('COMPOSER_URL'), 'composer-setup.php'); \
if (hash_file('sha384', 'composer-setup.php') === getenv('COMPOSER_SIGNATURE')) { \
@Tymek
Tymek / todo.sh
Created December 17, 2018 11:34
Find my TODOs in project and open first in VSCode
# https://stackoverflow.com/a/25042219
git grep -l TODO \
| xargs -n1 git blame -f -n -w \
| grep "$(git config user.name)" \
| grep TODO \
| sed "s/.\{9\}//" \
| sed "s/(.*)[[:space:]]*//" \
| tee /dev/tty \
| sed 's/\s.*$//' \
@Tymek
Tymek / .gitconfig
Last active December 17, 2018 11:38
My Git configuration
[alias]
a = add
aa = add .
tree = log --all --decorate --date=relative --date-order --graph --pretty=format:'\t%C(auto)%h %C(cyan)%ad%C(auto)%d %s %C(green)[%cn]'
br = branch
co = checkout
s = stash
sh = stash
stash = stash pop
st = status
@Tymek
Tymek / server.sh
Last active February 13, 2019 00:42 — forked from jrnickell/serve-static
Simple static files server with Python in Docker
docker run \
-v $(pwd):$(pwd) \
-w $(pwd) \
-p 0.0.0.0:80:80 \
-it --rm --name="python-http-server" python:3 python \
-m http.server 80
@Tymek
Tymek / isOverlaping.js
Last active March 6, 2019 19:34
Time/date (timestamps) segments overlap in Ramda
/**
* @see: https://gist.github.com/Tymek/10282cfecebdc16c962baf98e0314a57
*/
const {
apply,
compose,
lt,
max,
min,
@Tymek
Tymek / unusedActionTypes.js
Last active May 2, 2019 10:51
Find unused action types in Redux stores. no eslint rule for that :| easy to miss during actionTypes refactoring
#!/usr/bin/env node
const fs = require('fs')
const isWin = process.platform === "win32";
const findCmd = isWin ? 'dir /s *store.js' : 'find src -name "*store.js"'
const exec = require('child_process').exec
const findStores = () => new Promise((resolve, reject) => {
exec(
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
allow-hotplug ens4
iface ens4 inet dhcp
# "Failover"
auto ens3:0
@Tymek
Tymek / compose.log
Last active July 22, 2019 20:14
FusionAuth Docker
Attaching to fusionauth_fusionauth_1, fusionauth_db_1, fusionauth_search_1
fusionauth_1 | mkdir: cannot create directory '/usr/local/fusionauth/fusionauth-app/apache-tomcat/../../logs': Permission denied
fusionauth_1 | 22-Jul-2019 19:29:14.550 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Server} Setting property 'port' to '${fusionauth.management.port}' did not find a matching property.
fusionauth_1 | 22-Jul-2019 19:29:15.444 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'port' to '${fusionauth.http.port}' did not find a matching property.
fusionauth_1 | 22-Jul-2019 19:29:15.451 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'redirectPort' to '${fusionauth.https.port}' did not find a matching property.
fusionauth_1 | 22-Jul-2019 19:29:15.846 WARNING [main] org.apache.catalina.startup
@Tymek
Tymek / rule.js
Last active December 28, 2019 20:38
Auth0 rule for JWT Hasura roles
function (user, context, callback) {
// console.log('context', context);
const namespace = "https://hasura.io/jwt/claims";
const roles = (context.authorization || {}).roles || [];
const claims = {
'x-hasura-default-role': 'user',
'x-hasura-allowed-roles': [
'anonymous',
'user',
@Tymek
Tymek / machine.js
Last active May 21, 2020 21:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions