Skip to content

Instantly share code, notes, and snippets.

@Mic92
Mic92 / wormhole-client
Last active February 13, 2022 19:35
Proof of concept for sharing tmux with wormhole port forwarding based on https://github.com/magic-wormhole/magic-wormhole.rs/pull/135/
#!/usr/bin/env bash
set -eux -o pipefail
export PATH=$(pwd)/target/debug:$PATH
wormhole forward connect --port=2010 "$1" &
sleep 10
socat file:`tty`,raw,echo=0 tcp-connect:localhost:2010
@Mic92
Mic92 / ubuntu-sleep.yaml
Created January 20, 2022 14:51 — forked from tcdowney/ubuntu-sleep.yaml
Ubuntu Sleep Pod
apiVersion: v1
kind: Pod
metadata:
name: ubuntu
labels:
app: ubuntu
spec:
containers:
- image: ubuntu
command:
@Mic92
Mic92 / default.nix
Last active December 20, 2021 12:44
package for llvm lnt
{ python3, fetchFromGitHub, lib, lit }:
let
packageOverrides = self: super: {
sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec {
version = "1.2.19";
src = super.fetchPypi {
pname = "SQLAlchemy";
inherit version;
@Mic92
Mic92 / default.nix
Created August 6, 2021 14:11
unwrapped clang
with import <nixpkgs> {};
let
gccForLibs = stdenv.cc.cc;
in mkShell {
buildInputs = [
llvmPackages_11.clang-unwrapped
];
disableHardening = true;
CFLAGS = ''-target x86_64-unknown-linux-gnu -resource-dir=${llvmPackages_11.clang}/resource-root -B${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version} -B${llvmPackages_11.clang-unwrapped} --gcc-toolchain=${gccForLibs} -B${stdenv.cc.libc}/lib -idirafter ${stdenv.cc.libc.dev}/include'';
#!/usr/bin/env python3
import pdb
import os
from tempfile import TemporaryDirectory
def format_bytes(size):
# 2**10 = 1024
power = 2 ** 10
FROM summerwind/actions-runner:latest
ARG GCC_VERSION=10
ARG RUST_VERSION=1.51.0
RUN sudo apt update -y \
&& sudo apt install -y pkg-config libfuse-dev fuse bison flex cmake automake meson libprotobuf-dev protobuf-compiler libgflags-dev gcc-${GCC_VERSION} g++-${GCC_VERSION} \
&& sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} \
15 \
--slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} \
@Mic92
Mic92 / flake-module.nix
Last active May 30, 2021 20:47
What if flake outputs were a module?
# specialArgs provided as module parameters:
# - pkgs = inputs.nixpkgs.legacyPackages.${system};
# - inputs = flake.inputs with ${system} stripped
# This design requires two phases:
# 1. First evaluation collects all `meta.platforms`. While doing this, we set `pkgs = {};` and `inputs == {}`.
# 2. Than we evaluate for every output attribute and for every platform listed in `meta.platforms`.
# TODO: How to make outputs extensible?
# Do we even want this? Maybe having a standard interface would be better?
{ config, pkgs, inputs, ... }: {
meta.platforms = [ "x86_64-linux" ]; # defaults to nixpkgs.lib.defaultPlatforms;
diff --git a/tests/test_single_commands.py b/tests/test_single_commands.py
index 3eaed01..45b1d7a 100644
--- a/tests/test_single_commands.py
+++ b/tests/test_single_commands.py
@@ -25,8 +25,8 @@ def main() -> None:
proc = run_project_executable(
"shell", input="ls /proc/self/fd\n", stdout=subprocess.PIPE
)
- out = proc.stdout
- expected = "0\n1\n2\n3\n"
with import <nixpkgs> {};
let
version = "19.02";
in
linuxPackages.dpdk.overrideAttrs (old: {
src = fetchurl {
url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
# when changing a version update the hash from output of the failing build.
sha256 = "sha256-QLpRVqL7DN89cG0xoaORLnv8STiQ3IQUk/7gBayAVRs=";
};
@Mic92
Mic92 / shell.nix
Created May 4, 2021 14:12
get x86 binaries on aarch64-linux
with import <nixpkgs> {};
let
x86pkgs = import <nixpkgs> {
localSystem = { system = "x86_64-linux"; };
};
in
mkShell {
X86_DEPS = buildEnv {
name = "x86-deps";