Skip to content

Instantly share code, notes, and snippets.

View little-dude's full-sized avatar
🍉

little-dude

🍉
View GitHub Profile
@little-dude
little-dude / git_proxy.sh
Created May 25, 2018 17:25
set git proxies
# Set a git proxy for the SSH a git protocols in the current shell.
#
# Note that for SSH you can also set the Proxycommand in the ~/.config/ssh
# file, which might be more convenient than setting that in each shell
#
# Host gh
# User git
# Hostname github.com
# Port 22
# IdentityFile ~/.ssh/my_key
@little-dude
little-dude / ipv6.rs
Created June 21, 2018 18:17
ipv6 parsing in Rust
use std::fmt;
use std::error::Error;
use std::str::FromStr;
pub struct Ipv4Network(u32, u32);
pub struct Ipv6Network(u128, u128);
#[derive(Debug)]
pub struct MalformedAddress(String);
@little-dude
little-dude / fetch.js
Created August 27, 2018 19:06
custom fetcher
class ResponseError {
constructor(response) {
this.response = response;
}
async read() => {
return this.response
.text()
.then(body => {
return {
yarn run v1.16.0
$ /home/corentin/code/clojure/learn-reagent-course-files/giggin/node_modules/.bin/shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.1 -d cider/cider-nrepl:0.22.0-beta4 server
shadow-cljs - config: /home/corentin/code/clojure/learn-reagent-course-files/giggin/shadow-cljs.edn cli version: 2.3.30 node: v11.15.0
shadow-cljs - starting ...
shadow-cljs - Using IP "192.168.43.195" from Interface "wlp58s0"
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (file:/home/corentin/.m2/repository/org/jboss/xnio/xnio-nio/3.3.8.Final/xnio-nio-3.3.8.Final.jar) to constructor sun.nio.ch.EPollSelectorProvider()
WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2
use futures::{
stream::Stream,
task::{Context, Poll},
Future,
};
use std::pin::Pin;
use tokio::sync::mpsc::{Receiver, Sender};
/// Dummy structure that represent some state we update when we
/// receive data or events.

Setting up NixOs with LUKS encrypted root

Here are my working notes on getting a system up and running.

WARNING: You can run into a hidden problem that will prevent a correct partition setup and /etc/nixos/configuration.nix from working: if you are setting up a UEFI system, then you need to make sure you boot into the NixOS installation from the UEFI partition of the bootable media. You may have to enter your BIOS boot selection menu to verify this. For example, if you setup a NixOS installer image on a flash drive, your BIOS menu may display several boot options from that flash drive: choose the one explicitly labeled with “UEFI”.

References

I used these resources:

pub fn parse_ip(payload: &[u8]) -> Result<IpAddr, DecodeError> {
match payload.len() {
4 => Ok(Ipv4Addr::new(payload[0], payload[1], payload[2], payload[3]).into()),
16 => Ok(Ipv6Addr::from([
payload[0],
payload[1],
payload[2],
payload[3],
payload[4],
// This runs into https://github.com/rust-lang/rust/issues/56105
pub trait MyTrait<T> {
fn method(&self, _:T);
}
impl<T> MyTrait<T> for Box<dyn MyTrait<T>> {
fn method(&self, t: T) {
(**self).method(t)
}
@little-dude
little-dude / dyn_trait_plus_other_trait.rs
Created February 1, 2022 09:27
dyn Trait + OtherTrait
use std::fmt::Debug;
trait MyTrait: Debug {
fn m(&self);
}
#[derive(Debug)]
struct Foo;
impl MyTrait for Foo {