Skip to content

Instantly share code, notes, and snippets.

@acg
acg / combine-repos-into-mono-repo.md
Created July 10, 2023 17:31
How to combine two git repos into a monorepo without `git merge`

Use Case

Suppose you have local checkouts of two git repositories, a and b. You'd like to combine them into a new git repo c ("the monorepo"). More specifically, you'd like to:

  1. Preserve the combined commit history.
  2. Keep the commits from a and b ordered chronologically in c, interleaving as necessary.
  3. Avoid new merge commits, because you're a rebase-only freak like me. Most answers on the internet use git merge.
  4. Ignore all branches of a and b other than master. It's possible to port them over, but would significantly complicate these instructions. So for now that's an exercise left for the reader.

Preliminaries

@alexellis
alexellis / kvm_minikube.md
Last active July 26, 2024 01:47
Run multiple minikube Kubernetes clusters on Ubuntu Linux with KVM

Ramp up your Kubernetes development, CI-tooling or testing workflow by running multiple Kubernetes clusters on Ubuntu Linux with KVM and minikube.

In this tutorial we will combine the popular minikube tool with Linux's Kernel-based Virtual Machine (KVM) support. It is a great way to re-purpose an old machine that you found on eBay or have gathering gust under your desk. An Intel NUC would also make a great host for this tutorial if you want to buy some new hardware. Another popular angle is to use a bare metal host in the cloud and I've provided some details on that below.

We'll set up all the tooling so that you can build one or many single-node Kubernetes clusters and then deploy applications to them such as OpenFaaS using familiar tooling like helm. I'll then show you how to access the Kubernetes clusters from a remote machine such as your laptop.

Pre-reqs

  • This tutorial uses Ubuntu 16.04 as a base installation, but other distributions are supported by KVM. You'll need to find out how to install
@BanzaiMan
BanzaiMan / camera.rb
Created April 30, 2017 16:21
OpenCV: Show what camera sees, capture if anything other than 'q' is pressed
require 'rubygems'
require 'opencv'
include OpenCV
camera = CvCapture.open(1)
window = GUI::Window.new("camera")
while true
@2E0PGS
2E0PGS / linux-usb-file-copy-fix.md
Last active November 17, 2024 22:06
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

I suggest you edit your /etc/rc.local file to make this change persistant across reboots.

sudo nano /etc/rc.local

@manasthakur
manasthakur / grepping.md
Last active September 24, 2022 13:30
Vim: Creating your own ack.vim/ag.vim

Creating your own ag.vim

Vim provides built-in mechanisms to search through projects in the form of the grep command. However, on large projects, grep is known to be slow; and hence people have been switching to simpler searchers like ack, and faster, parallel (metal?) searchers like ag and pt. Correspondingly, several plugins have been created that integrate these tools in vim: ack.vim, ag.vim, etc.

However, it's actually very easy to get the functionalities these plugins provide (faster search, results in quickfix-window, jumps, previews, and so on) in vanilla Vim itself; in fact, Vim already populates the grep-search results in a quickfix window. We just need to tell Vim to do the following things (use-case: ag):

  • Use ag as the default grep program
  • Open quickfix window by default
  • Create mappin
@tknv
tknv / gpg-agent.conf
Created November 17, 2016 17:28
~/.gnupg/gpg-agent.conf
default-cache-ttl 28800
# 8 hours
pinentry-program /usr/bin/pinentry-curses
allow-loopback-pinentry
@gvergnaud
gvergnaud / Promises-under-the-hood.md
Last active August 27, 2024 00:29
Promises, under the hood.

Promises, under the hood

Everyone knows that to create a new Promise, you need to define it this way:

  new Promise((resolve, reject) => {
    ...
    resolve(someValue)
  })

You pass a callback that defines the specific behavior of your promise.

@olih
olih / jq-cheetsheet.md
Last active November 18, 2024 01:10
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@xero
xero / irc.md
Last active October 29, 2024 15:25
irc cheat sheet
@stuart-warren
stuart-warren / simple-gpg-enc.go
Last active August 30, 2024 05:58
golang gpg/openpgp encryption/decryption example
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)