Skip to content

Instantly share code, notes, and snippets.

View Mattias-'s full-sized avatar

Mattias Appelgren Mattias-

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mattias- on github.
  • I am mappelgren (https://keybase.io/mappelgren) on keybase.
  • I have a public key whose fingerprint is F321 0697 5460 8F06 09DE 352E 0EBD 5A50 C549 EC34

To claim this, I am signing this object:

#!/bin/bash
security find-certificate -a /System/Library/Keychains/SystemRootCertificates.keychain
from collections import defaultdict
names = """
audino bagon baltoy banette bidoof braviary bronzor carracosta charmeleon
cresselia croagunk darmanitan deino emboar emolga exeggcute gabite
girafarig gulpin haxorus heatmor heatran ivysaur jellicent jumpluff kangaskhan
kricketune landorus ledyba loudred lumineon lunatone machamp magnezone mamoswine
nosepass petilil pidgeotto pikachu pinsir poliwrath poochyena porygon2
porygonz registeel relicanth remoraid rufflet sableye scolipede scrafty seaking
#!/usr/bin/env python
from __future__ import print_function
import collections
import subprocess
import time
ProcTuple = collections.namedtuple('ProcTuple', ['process', 'command',
'start_time'])
cd ~/VirtualBox\ VMs/vm_name
VBoxManage clonehd box-disk1.vmdk tmp-disk.vdi --format vdi
VBoxManage modifyhd tmp-disk.vdi --resize 61440
VBoxManage clonehd tmp-disk.vdi resized-disk.vmdk --format vmdk
rm tmp-disk.vdi box-disk1.vmdk
mv resized-disk.vmdk box-disk1.vmdk
def test(fun):
lists = [
[],
[0],
[1],
[-1],
[3, 3],
[1, 2],
#!/bin/bash
set -e
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update -y
apt-get upgrade -y
apt-get install -y \
apt-transport-https \
ca-certificates \
#!/usr/bin/env bash
# Copyright (c) 2018 The CoreOS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
usage() {
echo "Usage: $0 [-d|-n|-h] <device>" 1>&2
}
@Mattias-
Mattias- / create_reproducable_repo.sh
Created October 5, 2019 14:04
Reproducable repo
#!/bin/bash
set -eu
git init "$1"
export GIT_AUTHOR_DATE='2000-01-01 00:00:00 +0000'
export GIT_AUTHOR_NAME='a'
export GIT_AUTHOR_EMAIL='a'
export GIT_COMMITTER_DATE="${GIT_AUTHOR_DATE}"
export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME}"
export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}"
git -C "$1" commit --allow-empty -m "Initial commit" -m "Randomly constructed message:
#!/bin/bash
es_url="localhost:9200"
index="logstash-123"
response=$(curl -s -H 'Content-Type: application/json' "$es_url/$index/_search?scroll=5m&size=10000")
scroll_id=$(jq -r '._scroll_id' <<<"$response")
hits_count=$(jq -r '.hits.hits | length' <<<"$response")
hits_so_far=hits_count
echo "Got initial response with $hits_count hits and scroll ID $scroll_id"