Skip to content

Instantly share code, notes, and snippets.

View mtpereira's full-sized avatar
🌴
On vacation

Manuel Tiago Pereira mtpereira

🌴
On vacation
View GitHub Profile
@wholroyd
wholroyd / preparations.md
Last active May 4, 2024 23:56
Getting Minikube on WSL2 Ubuntu working

Windows Preparation

  1. Ensure hypervisor functionality is enabled in BIOS.

    • I know it sounds stupid, but if you already have it enabled, disable it, restart the machine, and enable it again.
    • Otherwise you will hit microsoft/WSL#5363
  2. Launch a PowerShell prompt in Administrator mode [Win+X > Windows PowerShell (Admin)]

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
@jacoelho
jacoelho / alb-asg.tf
Created December 4, 2017 10:54
alb asg
resource "aws_alb_target_group" "test" {
name = "test-alb"
port = 443
protocol = "HTTPS"
vpc_id = "${aws_vpc.test.id}"
deregistration_delay = 200
stickiness {
type = "lb_cookie"
cookie_duration = 10000
}
@asukakenji
asukakenji / go-stdlib-interface-selected.md
Last active May 4, 2024 14:16
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

@MrTrustor
MrTrustor / clean-docker-for-mac.sh
Last active November 21, 2023 11:38
This script cleans the Docker.qcow2 file that takes a lot of disk space with Docker For Mac. You can specify some Docker images that you would like to keep.
#!/bin/bash
# Copyright 2017 Théo Chamley
# 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:
#
# The above copyright notice and this permission notice shall be included in all copies or
@m-ou-se
m-ou-se / replace-debian-with-arch.txt
Last active October 22, 2023 12:16
Instructions to replace a live Debian installation with Arch
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/
wget 'ftp://ftp.nluug.nl/pub/os/Linux/distr/archlinux/iso/latest/archlinux-bootstrap-*-x86_64.tar.gz'
# Make sure you'll have enough entropy for pacman-key later.
apt-get install haveged
# Install the arch bootstrap image in a tmpfs.
mount -t tmpfs none /mnt
cd /mnt
tar xvf ~/archlinux-bootstrap-*-x86_64.tar.gz --strip-components=1
@takeshixx
takeshixx / hb-test.py
Last active March 9, 2024 13:37
OpenSSL heartbeat PoC with STARTTLS support.
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
@mattiaslundberg
mattiaslundberg / arch-linux-install
Last active March 29, 2024 08:38
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@stereoscott
stereoscott / active_admin_extensions.rb
Created January 12, 2014 00:29
Sample ActiveRecord model that uses paperclip to upload a csv report to s3
module ActiveAdmin
module Reports
module DSL
def enable_reports
action_item only: :index do
link_to("Download", {action: :report, params: params}, {method: :post, data: { confirm: "Are you sure you want to generate this report?"}})
end
collection_action :report, method: :post do
@kuntoaji
kuntoaji / progress_bar.rb
Created September 6, 2013 06:54
Simple progress bar script without Gem using Ruby.
#!/usr/bin/env ruby
progress = 'Progress ['
1000.times do |i|
# i is number from 0-999
j = i + 1
# add 1 percent every 10 times
if j % 10 == 0
execute "vagrant-berkshelf plugin" do
command "vagrant plugin install vagrant-berkshelf --plugin-version 1.2.0"
user jenkins_data['user']
environment({'HOME' => jenkins_data[:home]})
not_if do
if ::File.exists?(::File.join(jenkins_vagrant, "plugins.json"))
plugins = JSON.parse(
IO.read(::File.join(jenkins_vagrant, "plugins.json"))
)
plugins['installed'].include?('vagrant-berkshelf')