Skip to content

Instantly share code, notes, and snippets.

$ErrorActionPreference="Stop"
# Considerable performance boost withour realtime monitoring.
# This is usually okay on temporary test systems. Don't do this
# on your own machine.
Set-MpPreference -DisableRealtimeMonitoring:$true
wget -UseBasicParsing -OutFile "$HOME\prepare_env_windows.ps1" -Uri https://gist.githubusercontent.com/gabriel-samfira/c80ccb1d79be737e5e61214181e48ad8/raw/4aa3d3efe643f70c9b8bcd139b3afca798900262/prepare_env_windows.ps1
& "$HOME\prepare_env_windows.ps1"
@gabriel-samfira
gabriel-samfira / prepare_env_windows.ps1
Last active August 31, 2023 11:08
Installs needed dependencies
# Prepare windows environment for building and running containerd tests
$PACKAGES= @{ mingw = "12.2.0"; git = ""; golang = ""; make = ""}
Write-Host "Downloading chocolatey package"
curl.exe -L "https://packages.chocolatey.org/chocolatey.0.10.15.nupkg" -o 'c:\choco.zip'
Expand-Archive "c:\choco.zip" -DestinationPath "c:\choco"
Write-Host "Installing choco"
& "c:\choco\tools\chocolateyInstall.ps1"
@gabriel-samfira
gabriel-samfira / enable_ssh_on_windows.ps1
Created November 9, 2021 10:57
slight improvement to fetch ssh keys from github
Param(
[parameter(Mandatory=$true)]
[string]$SSHPublicKey
)
$ErrorActionPreference = "Stop"
function Get-SSHKeyFromGithub {
Param(
@gabriel-samfira
gabriel-samfira / render_markdown.go
Created September 22, 2020 21:49
Renders markdown files stored in a folder
package main
import (
"flag"
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
"strings"
@gabriel-samfira
gabriel-samfira / x509_with_UPN.go
Last active February 5, 2025 13:02
Generate a self signed x509 with Microsoft UPN extension
package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"crypto/x509/pkix"
"encoding/asn1"
"encoding/pem"

Keybase proof

I hereby claim:

  • I am gabriel-samfira on github.
  • I am gsamfira (https://keybase.io/gsamfira) on keybase.
  • I have a public key ASDmtXlJLxsYwtS2Ckk_ssBTqhzOfTvPTvzeAaT34sqNJAo

To claim this, I am signing this object:

@gabriel-samfira
gabriel-samfira / do-dyn-dns.py
Created June 18, 2019 11:47
quick and dirty dynamic DNS updater for digital ocean
#!/usr/bin/env python3
import requests
import digitalocean
import sys
TOKEN="your secret goes gere"
DOMAIN="example.com"
RECORD="my-record"
@gabriel-samfira
gabriel-samfira / gen_certs.go
Last active December 15, 2019 22:19
Generate certificates for quick testing. This generates a CA, server cert and client cert. The CA allows client certificate verification. By default local hostname and IPs are added to the certificate. Use -certificate-hosts to add a comma separated list of aditional hosts/ips.
package main
import (
"crypto/ecdsa"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"flag"
@gabriel-samfira
gabriel-samfira / nbd.py
Last active May 22, 2023 19:11
python NBD client
# Copyright 2017 Cloudbase Solutions SRL
# All Rights Reserved.
#
# 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