Skip to content

Instantly share code, notes, and snippets.

View andsens's full-sized avatar

Anders Ingemann andsens

View GitHub Profile
@andsens
andsens / npm-list-pkg-lock.json
Last active September 8, 2017 11:22
`npm list --json` when package-lock.json is absent and present
npm list --json
{
"name": "@secoya/rabbitmq-tools",
"version": "0.1.8",
"problems": [
"missing: amqplib@0.4.2, required by @secoya/rabbitmq-tools@0.1.8",
"missing: babel-runtime@6.9.2, required by @secoya/rabbitmq-tools@0.1.8",
"missing: bitsyntax@0.0.4, required by amqplib@0.4.2",
"missing: buffer-more-ints@0.0.2, required by amqplib@0.4.2",
"missing: readable-stream@1.1.14, required by amqplib@0.4.2",
@andsens
andsens / deinit.sh
Last active September 18, 2017 16:17
Deinitialize a submodule and merge it as a branch
#!/bin/bash -xe
deinit() {
module_path=$1
test -d $module_path
current_branch=$(git rev-parse --abbrev-ref HEAD)
url=$(cd $module_path; git config --get remote.origin.url)
remote_name=$(basename $url)
branch_name=$(basename $url)
head=$(cd $module_path; git rev-parse HEAD)
@andsens
andsens / chrooted.sh
Created April 28, 2014 12:32
Configure server for chrooted sftp users and create those users
#!/bin/bash
# source this file in /root/.bashrc or /root/.zshrc
# Sets up the server for chrooted users
configure_chrooted() {
grep ^chrooted: /etc/group
if [[ $? == 0 ]]; then
printf "The chrooted group already exists, aborting...\n"
exit 1
@andsens
andsens / Corefile
Last active February 12, 2019 12:38
Minikube DNS addon
.:53 {
cache 30
log
errors
prometheus
etcd k8s {
stubzones
endpoint http://etcd:2379
}
}
@andsens
andsens / crd.yaml
Created March 6, 2019 16:13
skaffold reproduce
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
name: certificates.certmanager.k8s.io
spec:
additionalPrinterColumns:
- JSONPath: .status.conditions[?(@.type==\"Ready\")].status
@andsens
andsens / skaffold.log
Created March 8, 2019 09:40
skaffold deploy debug output
INFO[0000] Skaffold &{Version:v0.24.0 ConfigVersion:skaffold/v1beta6 GitVersion: GitCommit:6a829c4b29e3a102b0b14c4584cd174f780402e9 GitTreeState:clean BuildDate:2019-03-01T20:36:32Z GoVersion:go1.12 Compiler:gc Platform:darwin/amd64}
DEBU[0000] Defaulting build type to local build
INFO[0000] no config entry found for kube-context ops.orbit.dev
INFO[0000] Using kubectl context: ops.orbit.dev
INFO[0000] no config entry found for kube-context ops.orbit.dev
DEBU[0000] Using builder: local
DEBU[0000] setting Docker user agent to skaffold-v0.24.0
INFO[0000] no config entry found for kube-context ops.orbit.dev
DEBU[0000] push value not present, defaulting to true because localCluster is false
Starting build...
@andsens
andsens / Dockerfile
Last active June 6, 2019 14:14
Kibana docker container with pre-optimized bundles
ARG KIBANA_VERSION
FROM docker.elastic.co/kibana/kibana:${KIBANA_VERSION}
ARG KIBANA_VERSION
ARG LOGTRAIL_VERSION
USER root
RUN NODE_OPTIONS="--max_old_space_size=4096" kibana-plugin install https://github.com/sivasamyk/logtrail/releases/download/v${LOGTRAIL_VERSION}/logtrail-${KIBANA_VERSION}-${LOGTRAIL_VERSION}.zip
COPY kibana.yaml /usr/share/kibana/config/kibana.yml
COPY elasticsearch.repo /etc/yum.repos.d/elasticsearch.repo
@andsens
andsens / naval_fate.sh
Created July 29, 2019 22:26
Demonstration of docopt.sh
#!/usr/bin/env bash
DOC="Naval Fate.
Usage:
naval_fate.sh ship <name> move <x> <y> [--speed=<kn>]
naval_fate.sh ship shoot <x> <y>
Options:
--speed=<kn> Speed in knots [default: 10].
@andsens
andsens / Component.tsx
Created April 18, 2020 07:46
FragmentReference reproduce for relay-tools/relay-compiler-language-typescript
import { ComponentPaginationQuery } from "./artifacts/ComponentPaginationQuery.graphql";
import { Component_items$key } from "./artifacts/Component_items.graphql";
export function Component(props: { itemsFragment: Component_items$key }) {
const {
data: { items },
} = usePaginationFragment<ComponentPaginationQuery, Component_items$key>(
graphql`
fragment Component_items on Viewer
@argumentDefinitions(
@andsens
andsens / debian-init.sh
Last active October 5, 2021 09:38
This is a generic init-script, easily modifiable to suit your needs. It uses quite a lot of lsb init-functions and adheres to the lsb standards.
#!/bin/sh
### BEGIN INIT INFO
# Provides: generic-prog
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Generic Program
# Description: Generic Program is a generic program to do generic things with
### END INIT INFO