Skip to content

Instantly share code, notes, and snippets.

Avatar

Pieter Scheffers PieterScheffers

View GitHub Profile
@PieterScheffers
PieterScheffers / kubeshell
Created Jul 28, 2020
Get a shell to a Kubernetes node with root capabilities
View kubeshell
#!/bin/sh
# https://alexei-led.github.io/post/k8s_node_shell/
if [ -z "${1}" ]; then
echo "ERROR No kubernetes node supplied.
Script needs a node name as first argument!
Find node names with:
$ kubectl get node
@PieterScheffers
PieterScheffers / entries.ts
Created Mar 26, 2020
object.entries typescript
View entries.ts
type Entry<T> = [ keyof T, T[keyof T] ]
type Entries<T> = Entry<T>[]
type Key<T> = (keyof T)
type Keys<T> = Key<T>[]
type Value<T> = T[keyof T]
type Values<T> = Value<T>[]
type HasKeys<T> = { [key in keyof T]: any }
const keys = <T>(obj: T): Keys<T> => Object.keys(obj) as Keys<T>
const toEntries = <T>(obj: T): Entries<T> => Object.entries(obj) as Entries<T>
View CheckboxButton.js
import React from 'react';
import PropTypes from 'prop-types';
const style = {
label: {
display: 'inline',
fontFamily: 'RobotoCondensed-Regular, sans-serif',
userSelect: 'none', // disable text selection
fontWeight: 'bold'
},
View makefile_windows.txt
https://www.oreilly.com/library/view/managing-projects-with/0596006101/ch07.html
@PieterScheffers
PieterScheffers / transip_stack_clear_trash.sh
Last active Jun 29, 2020
TransIP Stack - Clear Trash
View transip_stack_clear_trash.sh
#!/bin/sh
STACK_URL=myuser.stackstorage.com
STACK_USER=myuser
STACK_PASSWORD=nooneknowsthis
curl \
--silent \
-X POST \
-H "Content-Type: application/json" \
@PieterScheffers
PieterScheffers / trello_add_week.js
Created Mar 19, 2019
Trello add a list for each weekday
View trello_add_week.js
// Trello
// Add a List for each weekday
// Pass throught https://skalman.github.io/UglifyJS-online/
// Then add 'javascript:' before the code
// and add 'void(0);' after the code
// Add a bookmark in Chrome and put this as the url
(function () {
function getLastDate (lastDate = null) {
@PieterScheffers
PieterScheffers / .bashrc
Last active Jul 6, 2020
Download new kubeconfig when it is older as 6 days for DigitalOcean kubernetes
View .bashrc
#!/usr/bin/env bash
# DigitalOcean Kubernetes
# The kubeconfig you download from DigitalOcean invalidates every 7 days
# By appending this to your .bashrc file the kubeconfig gets refreshed every 6 days
#
# Pre
# - install 'doctl': https://github.com/digitalocean/doctl#installing-doctl
# - auth with DigitalOcean API token: https://github.com/digitalocean/doctl#authenticating-with-digitalocean
#
View minimal-analytics-snippet.js
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@PieterScheffers
PieterScheffers / bash-compose.sh
Created Oct 15, 2018
Compose multiple service like docker-compose without docker
View bash-compose.sh
#!/bin/bash
mkdir -p logs
npm install
lerna bootstrap
# Start RabbitMQ / Redis and Mongodb
docker-compose -f docker/docker-compose.yml up -d
sleep 10
View git_cheatsheet.sh
# Force push
git push --force
# Pull origin when origin has been force pushed (from master branch)
git reset --hard origin/master
# Base feature branch on new force-pushed master
# Assumes feature branch has 2 commits
git rebase HEAD~2 myfeature --onto master
You can’t perform that action at this time.