Skip to content

Instantly share code, notes, and snippets.

View johanforssell's full-sized avatar

Johan Forssell johanforssell

  • NaN
  • Sweden
  • 07:31 (UTC +02:00)
View GitHub Profile
@johanforssell
johanforssell / delete-route53-query-logging.sh
Last active March 28, 2024 07:41
Use the AWS CLI to delete all Route53 query logging configs
#!/bin/sh
# Make sure you're authenticated to use the AWS CLI.
#
# List all Route 53 query logging configs, iterate over their Ids and delete them.
# The call to jq flattens the list of configs down to just the list of Ids.
#
aws route53 list-query-logging-configs \
| jq -r '.[][]|[.Id]|@tsv' \
@johanforssell
johanforssell / list_private_workload_amis.sh
Last active April 19, 2023 19:58
List all private EC2 AMI whose name begins with the string `workload`
#!/bin/sh
# List all private EC2 AMI whose name begins with the string `workload`
# Present the output as a table
aws ec2 describe-images \
--query 'Images[*].{created:CreationDate,ami:ImageId,name:Name}' \
--filters "Name=name,Values=workload*" "Name=image-type,Values=machine" "Name=is-public,Values=false" \
--output table
@johanforssell
johanforssell / list_private_ips.sh
Last active April 19, 2023 10:04
Sorted list of resources with private IP in a Terraform state file
#!/bin/sh
# This script goes through a terraform state file and looks for private IPs.
# It will present them as an IP-sorted list, like so
# Private IP ADDRESS
# ----------- -------
# 10.16.0.4 aws_eip.zz-prd-nateip-az_a
# 10.16.0.4 aws_nat_gateway.zz-prd-natgw-az_a
#
# There will be duplicate private IPs, that's expected.
@johanforssell
johanforssell / fix ENOMEM in docker container
Created March 31, 2021 07:52
Fixing error "Unable to lock JVM memory (ENOMEM)" in docker containers
Taken from https://www.youtube.com/watch?v=jgFzhhc7-e8
TLDR; set `LimitMEMLOCK=infinity` for the docker deamon to trickle down to the containers.
---
What's the PID of your Docker daemon?
> sudo service docker status | grep -P -o 'dockerd\[[0-9]+\]' | head -1 | grep -P -o [0-9]+
Check the limits for that process
@johanforssell
johanforssell / hyper.js
Created May 14, 2019 05:56
default hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',

I'm writing new versions of old apps, and thus I have inherited old app id's. In order to install AND RUN a flavor I need to do stuff manually. react-native run-android --variant appAAADebug does manage to get the app runnning (only installed)

--

My code have the package com.common.package (in source files and AndroidManifest.xml).

My build.gradle contains

@johanforssell
johanforssell / .Xmodmap
Last active June 7, 2018 06:07
CapsLock = windows key & left windows key = disabled
! Save as ~/.Xmodmap. Reload any changes with `xmodmap ~/.Xmodmap`
!
! Caps lock key is now the Windows (Super) key
! Left windows key is disabled
!
clear lock
remove mod4 = Super_L
keycode 66 = Super_L
keycode 133 =
@johanforssell
johanforssell / turn-off-cursor-animations-office.md
Created February 19, 2018 09:38
Slå av cursor-animationerna i Office 2016
@johanforssell
johanforssell / upgrade_ubuntu_wsl.md
Created February 15, 2018 14:22
Upgrade Ubuntu Xenial (16) to Artful (17.10) under WSL

Make sure Ubuntu can find the new version

$ sudo sed -i -e 's/^Prompt=.*$/Prompt=normal/' /etc/update-manager/release-upgrades

Check what can be installed

$ lsb_release -a
@johanforssell
johanforssell / gist:8237848
Last active January 2, 2016 02:29
Simple web server which accepts chunked uploads and responds with a dummy json
#!/usr/bin/python
import time
import BaseHTTPServer
import json
from pprint import pprint
HOST_NAME = '192.168.1.89'
PORT_NUMBER = 9494
media_results = {