This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/10644149/insert-into-with-subquery-mysql | |
# Use a SELECT instead of VALUES | |
# Then give static values an alias | |
# Add a new row | |
# value for position should be the highest position in group + 1 | |
INSERT INTO some_table (group_id, name, position) | |
SELECT | |
2 as group_id, | |
'bert' as name , |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for package in $(jq -r '.devDependencies | keys | .[]' package.json); do version=$(jq -r --arg pkg $package '.dependencies[$pkg].version' package-lock.json); echo "$package: $version"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- vncserver 2013-10-09 16:10:25.000000000 +0000 | |
+++ vncserver.new 2013-10-09 16:12:45.000000000 +0000 | |
@@ -296,7 +296,7 @@ sub CheckDisplayNumber | |
socket(S, $AF_INET, $SOCK_STREAM, 0) || die "$prog: socket failed: $!\n"; | |
eval 'setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))'; | |
- unless (bind(S, pack('S n x12', $AF_INET, 6000 + $n))) { | |
+ unless (bind(S, sockaddr_in(6000 + $n, &INADDR_ANY))) { | |
close(S); | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
STACK_URL=myuser.stackstorage.com | |
STACK_USER=myuser | |
STACK_PASSWORD=nooneknowsthis | |
curl \ | |
--silent \ | |
-X POST \ | |
-H "Content-Type: application/json" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.oreilly.com/library/view/managing-projects-with/0596006101/ch07.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://blog.hypriot.com/post/setup-simple-ci-pipeline-for-arm-images/ | |
### Choose a base image with QEMU binary | |
# FROM hypriot/rpi-alpine | |
# FROM resin/rpi-raspbian | |
# FROM resin/raspberry-pi-alpine-node:slim | |
### Register QEMU in the build agent | |
docker run --rm --privileged multiarch/qemu-user-static:register --reset |