Skip to content

Instantly share code, notes, and snippets.

View mahalel's full-sized avatar
🧬

Andrei Mahalean mahalel

🧬
  • Christchurch, New Zealand
  • 16:31 (UTC +12:00)
View GitHub Profile

Multiple GitHub accounts (Work vs Personal)

This setup uses some tricks to ensure that the right email/name/ssh-key is used for the right repos without having to think about it ever again.

  • First generate two SSH keys, ~/.ssh/id_ed25519 and ~/.ssh/id_ed25519_work
  • Add one key to your personal account and the other to your work account

.ssh/config

@m-radzikowski
m-radzikowski / script-template.sh
Last active April 25, 2024 18:43
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@johannesprinz
johannesprinz / Readme.md
Last active April 25, 2024 04:44
Migrating GitLab issues + history to Azure DevOps

Migrate-GitlabToDevops

Dependencies

You will need an access token from azure devops. Get yours here. This script will need contributor access to the project in question.

How to run

# populate user map in Map-IssueToWorkitem
@robinsmidsrod
robinsmidsrod / ubuntu_1804.ipxe
Last active July 4, 2023 09:11
iPXE script entries for booting Ubuntu 18.04 in different ways
# boot-url points to an nfs URL
# sanboot-url points to an http URL
# ubuntu-version contains 18.04.3
# ubuntu-release contains bionic
:ubuntu
echo Booting Ubuntu from iSCSI for ${initiator-iqn}
set root-path ${base-iscsi}:${hostname}.boot.ubuntu
sanboot ${root-path} || goto failed
goto start
/*
* Creates an XEvent session utilizing the 'Trace' event added to SQL 2016
* This event will capture the protocol negotiation details of all TLS connections
* This allows you to capture how many connections are being made and with what
* protocol version and cipher.
* This information can be used to predict the impact of disabling a given
* protocol version or cipher suite before taking such actions.
*/
CREATE OR ALTER PROCEDURE usp_get_tls_connection_stats
@BobGerman
BobGerman / csomHelper.csx
Last active February 20, 2023 11:14
Sample code for calling SharePoint CSOM from an Azure Function
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.SharePoint.Client;
using System.Security.Cryptography.X509Certificates;
public static class csomHelper {
private static string ClientId = "<fill in app ID>";
private static string Cert = "myCert.pfx"; // Fill in name of your cert file and upload it
private static string CertPassword = "<fill in cert password>"; // TODO: Explore more secure place for this
private static string Authority = "https://login.windows.net/<tenant>.onmicrosoft.com/";
@celisflen-bers
celisflen-bers / README.md
Last active March 11, 2022 11:45 — forked from bertspaan/README.md
Python script to convert DBF database file to CSV
@bitoiu
bitoiu / self-signed-wildcard-cert-for-ghes.md
Last active September 19, 2023 09:37
Self-Signed Wildcard certificate with SAN using openssl / SSL

Copy the default template of openssl.cnf to a writable location.

cp /System/Library/OpenSSL/openssl.cnf src

Uncomment the req_extensions = v3_req

req_extensions = v3_req # The extensions to add to a certificate request

Add subjectAltName to v3_req section