Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env sh
TOKEN="api-token"
master=${1:-"master"}
APIURL="https://api.github.com"
OWNER=$(git config --get user.name)
REPO=$(basename $(git rev-parse --show-toplevel))
git checkout -b master
git push origin master
curl -s -X PATCH "$APIURL/repos/$OWNER/$REPO" \
-d "{\"default_branch\":\"master\"}" \

w/o quotes:

docker build -t ${APP_TAG} ${REPO_URL}#${BUILD_BRANCH} -f ${APP_DF_PATH}

w/ quotes:

docker build -t ${APP_TAG} "${REPO_URL}#${BUILD_BRANCH}" -f ${APP_DF_PATH}
@kraftwerk28
kraftwerk28 / make_cert.sh
Last active July 5, 2020 13:42
Self-signed cert for local development w/ SSL. You will be able to use https://localhost:1234 instead of http, in simple words.
#!/usr/bin/env sh
tmp=${1:-ca-tmp}
mkdir -p $tmp
DEF_ROOT_NAME=RootCA
DEF_SRV_NAME=localhost
DEF_TERM=365
read -p "Name of root cert ($DEF_ROOT_NAME): " root
read -p "Name of server cert ($DEF_SRV_NAME): " srv
read -p "Certificates term in days ($DEF_TERM): " term
@kraftwerk28
kraftwerk28 / main.py
Created June 1, 2020 14:42
Keybr hack
#!/usr/bin/env python
# Run $('.TextInput-fragment').textContent in browser console
# Then run this script and copy-paste text from browser console to terminal.
# Script will Alt+Tab to browser so make sure it won't go to the wrong window.
import os
import time
import pyautogui as pag
import random
@kraftwerk28
kraftwerk28 / .gitignore
Last active May 30, 2020 13:59
Jordan-Gauss method
data/
test*/
iter*/
*.txt
__pycache__/
@kraftwerk28
kraftwerk28 / sync_vscode_settings.py
Created December 23, 2019 08:54
Script used to sync VSCode settings with gist
from os import getenv, path
import requests
from pprint import pprint
import json
from termcolor import colored
USERNAME = 'username'
TOKEN = 'your_github_app_token'
GHAPI = 'https://api.github.com'
GIST_ID = 'gist_id'
'use strict'
const { resolve, extname } = require('path')
const http = require('http')
const fs = require('fs')
const PORT = process.env.PORT || 8080
const PUBLIC_PATH = 'public/' // place it directory, where you execute node
const MIME_TYPES = {
@kraftwerk28
kraftwerk28 / Dockerfile
Created November 14, 2019 17:46
node:alpine vs node:slim
FROM node:slim
WORKDIR /opt/app
COPY ./ ./
EXPOSE 8080
CMD node ./