Skip to content

Instantly share code, notes, and snippets.

View NotBobTheBuilder's full-sized avatar

Jack Wearden NotBobTheBuilder

View GitHub Profile
@arcezd
arcezd / guide.raspbian.root.lvm.md
Last active November 18, 2024 07:32
Guide to move root Raspbian to LVM partition

Prepare the installation with LVM drivers

DISCLAIMER: Copied from [https://raspberrypi.stackexchange.com/questions/85958/easy-backups-and-snapshots-of-a-running-system-with-lvm/85959]

Moving the installation isn't the problem but the LVM drivers must be loaded on boot up so the root partition can be mounted and used for booting. Fortunately the Raspberry Pi supports loading a ramdisk for initrd so we have to do an additional step to create the initram containing drivers for LVM.

The following is only for a quick setup an initramfs where you have to monitor kernel updates by yourself. To use a more automated setup an initramfs you can look at How can I use an init ramdisk (initramfs) on boot up Raspberry Pi?.

If you are unexperienced with linux please try it first with a new image how I did for this How To. You can loose all data.

For reference I use Raspbian Buster with Desktop 2020-02-13, flashed it to a SD Card and boot it in a RasPi. First do an upgrade to get the latest software versions and instal

@brzez
brzez / hapi.sse.js
Created July 5, 2018 05:59
hapi 16 sse
// @flow
import {PassThrough} from 'stream';
class SSEStream extends PassThrough {
_compressor = null;
_read (size) {
super._read(size);
if (this._compressor) {
@boggle
boggle / unfixable.scala
Created April 10, 2017 12:39
How to generate extractors using shapeless to simplify pattern matching fixed point types from matryoshka
import matryoshka.data.Fix
import org.opencypher.spark.prototype.api.cyphertype.UnFixable.RecursiveExtractor
import matryoshka.Recursive
import shapeless.ops.hlist.Tupler
import scala.language.higherKinds
import scala.reflect.ClassTag
import scalaz.Functor
@simonw
simonw / recover_source_code.md
Last active September 28, 2024 08:10
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@koenkarsten
koenkarsten / Server.scala
Last active April 24, 2024 13:37
A simple TCP Socket Server made with Scala + Akka IO
import java.net.InetSocketAddress
import akka.actor.{ActorSystem, Props, Actor}
import akka.io.{Tcp, IO}
import akka.io.Tcp._
import akka.util.ByteString
class TCPConnectionManager(address: String, port: Int) extends Actor {
import context.system
IO(Tcp) ! Bind(self, new InetSocketAddress(address, port))
@searler
searler / FSMTCPClient.scala
Created July 18, 2015 20:58
Simple request/response TCP client using AKKA streams and FSM
package io
import scala.concurrent.duration.DurationInt
import scala.util.Success
import akka.actor.ActorRef
import akka.actor.ActorSystem
import akka.actor.FSM
import akka.actor.PoisonPill
import akka.actor.Props
@justecorruptio
justecorruptio / 2048.c
Created April 4, 2014 03:49
Tiny 2048 in C!
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
__all__ = ["transform"]
__version__ = '0.3'
__author__ = 'Christoph Burgmer <[email protected]>'
__url__ = 'http://github.com/cburgmer/upsidedown'
0 zero
1 one
2 two
3 three
4 four
5 five
6 six
7 seven
8 eight
9 nine
@p-baleine
p-baleine / README.md
Created November 29, 2013 08:59
Bookshelf polymorphic association example.

Migrate

$ ./node_modules/.bin/knex:migrate:latest -c db/config.js