Skip to content

Instantly share code, notes, and snippets.

View Johannestegner's full-sized avatar
🐇

Johannes Johannestegner

🐇
View GitHub Profile
@Johannestegner
Johannestegner / .env.example
Last active September 3, 2020 06:59
Laravel docker-compose setup.
APP_NAME=my-appity-app
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=database
@Johannestegner
Johannestegner / LICENSE.md
Last active August 9, 2020 12:41
UFW Auto-updater

MIT License

Copyright (c) 2020 Jitesoft

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@Johannestegner
Johannestegner / index.js
Last active February 13, 2020 19:12
rand.js
#!/usr/bin/env node
const { Manager, Command, Option, Argument } = require('@jitesoft/cli');
const random = require('@jitesoft/random-string').default;
const manager = new Manager('random-string', 'Generate random strings.');
manager.register(
new Command('gen', 'Generate a string.', {
args: [
new Argument('length', 'Length of the random string', true, Number)
],
@Johannestegner
Johannestegner / password5.txt
Created February 7, 2020 10:48
My seecret passwords, please dont read!
lozzzzzzzz123123
# I only use 1 password.
@Johannestegner
Johannestegner / helper.sh
Last active June 9, 2022 11:01
Helper file for conversion of architectures and tags for docker buildx.
#!/bin/ash
# This file contains a few different helper methods
# for building multi-arch images with docker buildx.
# Most of the methods is to convert tags and architectures, but it
# might be updated to contain more later on.
#
# Convert a "standard" architecture name into the format that buildx
# is expecting.
@Johannestegner
Johannestegner / GitlabConvert.py
Last active March 24, 2023 13:47
Convert Clair/Paclair output into Gitlab expected output for container scanning.
#!/usr/bin/env python
# LICENSE: MIT
# (c) - Johannes Tegner
import sys
import json
if len(sys.argv) < 2:
sys.stderr.write('Missing image name.')
@Johannestegner
Johannestegner / initscript.sh
Last active March 24, 2023 13:47
Init script for kubernetes...
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
# Pre-phase.
apt update
apt upgrade -y
apt install -y ufw apt-transport-https ca-certificates curl software-properties-common grep
# Apt keys and deb lists.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@Johannestegner
Johannestegner / github-release
Last active June 23, 2019 12:03
Minimal shell script to fetch latest version of a github release.
#! /bin/sh
# Requires the repo to have releases.
# Pass full repo uri.
REPO=$1
wget -qO- ${REPO}/releases/latest | grep -oP '(?<=releases\/tag\/)(.*?)(?=\&)' | awk 'NR==1{print $1}'
@Johannestegner
Johannestegner / About.md
Last active June 17, 2019 20:31
Script to generate certificates via remote cfssl server.

This file (gen.sh) is intended to be used to produce a set of certificates to be used by Kubernetes, Etcd and a DNS server of choice. It was created to quickly generate a new set of certificates for Jitesoft k8s cloud and generates new certificates and a ansible file for variables.

Use at your own risk, feel free to change and better it any way you wish!

@Johannestegner
Johannestegner / class.test.js
Created April 18, 2019 12:30
babel-jest async filesystem mock.
import SomeName from '../src/index';
import fs from 'fs';
jest.mock('fs');
describe('test!', () => {
test('The actual test!', async () => {
fs.writeFile = jest.fn((a, b, c) => c());
const n = new SomeName();
await n.runFunction();