Skip to content

Instantly share code, notes, and snippets.

@fvbock
fvbock / create-efi-keys.sh
Created October 23, 2019 03:39 — forked from Era-Dorta/create-efi-keys.sh
Sign kernel modules on Ubuntu, useful for Nvidia drivers in UEFI system
# VERY IMPORTANT! After each kernel update or dkms rebuild the modules must be signed again with the script
# ~/.ssl/sign-all-modules.sh
# Place all files in ~/.ssl folder
mkdir ~/.ssl
cd ~/.ssl
# Generate custom keys with openssl
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -subj "/CN=Owner/"
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
if [ -z $1 ]; then
echo "Usage: ./make-rpi.sh <hostname>"
echo " ./make-rpi.sh node-1"
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@fvbock
fvbock / bash.generate.random.alphanumeric.string.sh
Created October 17, 2018 09:30 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@fvbock
fvbock / echo_nc.sh
Created April 20, 2018 15:31 — forked from NapoleonWils0n/echo_nc.sh
bash: hex over tcp with netcat and echo
#!/bin/sh
#----------------------------------------------------------------------------------------#
# Hex over TCP with Echo and Netcat #
#----------------------------------------------------------------------------------------#
echo -n -e "x01x18x03" | nc 192.168.1.4 80
# The -n supresses outputting the trailing newline.
# The -e enables the interpretation of backslash escapes -- allowing us to send hex codes.
@fvbock
fvbock / main.go
Created March 7, 2018 16:28 — forked from julz/main.go
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@fvbock
fvbock / mongoconsole.sh
Created March 15, 2017 12:01 — forked from stanislavb/mongoconsole.sh
Backup and restore MongoDB running in a Docker container
#!/bin/bash
usage() {
echo "Usage $0 -c mongo_docker_container_name"
}
while [[ $# > 1 ]]
do
key="$1"
client = ElasticWrapper::Session.new.client
client.search(index: 'test', type: 'contacts', body: body)
body = { query: { bool: { filter: { term: { name: 'lachlan' } } } } }
=>
[{
"_index"=>"test",
"_type"=>"contact",
"_id"=>"1",
<?xml version="1.0" encoding="utf-8"?>
<Deck xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NetDeckID>0</NetDeckID>
<PreconstructedDeckID>0</PreconstructedDeckID>
<Cards CatID="44245" Quantity="2" Sideboard="false" Name="Cavern of Souls" />
<Cards CatID="60050" Quantity="2" Sideboard="false" Name="Forest" />
<Cards CatID="26015" Quantity="1" Sideboard="false" Name="Pendelhaven" />
<Cards CatID="38299" Quantity="2" Sideboard="false" Name="Razorverge Thicket" />
<Cards CatID="50274" Quantity="2" Sideboard="false" Name="Nykthos, Shrine to Nyx" />
<Cards CatID="60052" Quantity="4" Sideboard="false" Name="Forest" />
@fvbock
fvbock / translate.go
Created September 25, 2015 02:10 — forked from hvoecking/translate.go
Golang reflection: traversing arbitrary structures
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//