Skip to content

Instantly share code, notes, and snippets.

@cpcloud
cpcloud / configuration.nix
Last active May 30, 2021 19:25
rpi4 templtae
{ pkgs, ... }:
let
hardwareUrl = "https://github.com/NixOS/nixos-hardware/archive/684ae160a6e76590eafa3fca8061b6ad57bcc9ad.tar.gz";
in
{
imports = [
"${fetchTarball hardwareUrl}/raspberry-pi/4"
];
boot = {
pub fn munge<D, I>(&'a mut self, data: D) -> impl Iterator<Item = u8> + 'a
where
D: IntoIterator<Item = I> + 'a,
I: Borrow<u8> + 'a,
{
data.into_iter()
.zip(&mut self.key)
.map(|(byte, k)| byte.borrow() ^ k)
}
@cpcloud
cpcloud / Pulumi.dev.yaml
Last active March 19, 2021 14:44
Pulumi setup
# NB: `dev` is the stack name. You can call your stack whatever you want.
# The pulumi config should then be called `Pulumi.${my_stack_name}.yaml`.
config:
dev:nix_build_expr: "config.nodes.%s.configuration.system.build.googleComputeImage"
dev:image_bucket: "nixos-images"
dev:instances:
- name: $HOSTNAME_OF_YOUR_CHOOSING
disk:
size_gb: 500
type: "pd-ssd"
FROM alpine:latest
RUN apk add build-base
RUN apk add clang
RUN apk add boost-dev
COPY ./base.hpp .
COPY ./shmem_profile_consumer.cpp .
RUN clang++ -O3 -std=c++17 -o /usr/bin/consumer shmem_profile_consumer.cpp -lrt -I. -pthread
@cpcloud
cpcloud / shell.nix
Last active February 16, 2021 15:23
very rough shared memory profiling
let
pkgs = import <nixpkgs> { };
in
with pkgs;
mkShell {
name = "profile-shmem";
buildInputs = [ clang_11 boost ];
}
@cpcloud
cpcloud / ffgrid.sh
Created January 19, 2021 15:20
hardware accelerated ffmpeg hls mosaic
#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p ffmpeg-full -p bc -p findutils -p ripgrep
set -euxo pipefail
function join_by {
local d=$1
shift
local f=$1
shift
@cpcloud
cpcloud / 11
Created October 16, 2020 22:23
Add the nixos nvidia driver location and remove ldconfig
diff --git a/patch.sh b/patch.sh
index 8e572f5..1336cc0 100755
--- a/patch.sh
+++ b/patch.sh
@@ -252,6 +252,7 @@ patch_common () {
'/usr/lib/x86_64-linux-gnu/nvidia/current/'
'/usr/lib64'
"/usr/lib/nvidia-${driver_version%%.*}"
+ "/run/opengl-driver/lib"
)
@cpcloud
cpcloud / 11
Last active October 16, 2020 22:22
Add the nixos nvidia driver location
diff --git a/patch.sh b/patch.sh
index 8e572f5..fc85e4c 100755
--- a/patch.sh
+++ b/patch.sh
@@ -252,6 +252,7 @@ patch_common () {
'/usr/lib/x86_64-linux-gnu/nvidia/current/'
'/usr/lib64'
"/usr/lib/nvidia-${driver_version%%.*}"
+ "/run/opengl-driver/lib"
)
diff --git a/src/configuration/ArcanistConfigurationManager.php b/src/configuration/ArcanistConfigurationManager.php
index f1391a8b..8689c34e 100644
--- a/src/configuration/ArcanistConfigurationManager.php
+++ b/src/configuration/ArcanistConfigurationManager.php
@@ -181,7 +181,7 @@ final class ArcanistConfigurationManager extends Phobject {
'Config: Reading user configuration file "%s"...',
$user_config_path));
- if (!phutil_is_windows()) {
+ if (false) {
{ pkgs, ... }:
let unstable = import <nixpkgs-unstable> {};
vim-nginx = unstable.vimUtils.buildVimPlugin {
name = "nginx-vim";
src = unstable.fetchFromGitHub {
owner = "chr4";
repo = "nginx.vim";
rev = "a3def0ecd201de5ea7294cf92e4aba62775c9f5c";
sha256 = "038g7vg6krlpj0hvj3vbhbdiicly8v8zxvhs7an4fa1hr7gdlp4s";