Skip to content

Instantly share code, notes, and snippets.

@vmx
vmx / skip-rustc.py
Created January 21, 2022 15:55
Make GDB skip Rust's standard library files
# This script defines a command called `skiprustc` which skips all Rust
# standard library source files when debugging. Just drop this file into your
# `~/.gdbinit.d` directory.
# In order to enable it automatically whenever you debug Rust, you can add
# this hook to your `.gdbinit`:
#
# define hookpost-run
# skiprustc
# end
#
@vmx
vmx / cid-as-enum.rs
Created January 12, 2022 22:56
Trying to serialize a CID as enum
use std::fmt;
use serde::{de, ser, Deserialize, Serialize};
pub const ENUM_NAME: &str = "enumname";
pub const ENUM_VARIANT_NAME: &str = "enumvariantname";
//#[derive(Debug, PartialEq, Deserialize, Serialize)]
#[derive(Debug, PartialEq)]
pub struct Cid(String);
@vmx
vmx / runit.sh
Last active May 10, 2022 10:55
Get some power/energy metrics while running Filecoin proofs/sealing
#!/bin/sh
# From https://aweirdimagination.net/2020/06/28/kill-child-jobs-on-script-exit/
cleanup() {
# kill all processes whose parent is this process
sudo pkill -P $$
}
for sig in INT QUIT HUP TERM; do
trap "
@vmx
vmx / README.md
Created October 11, 2021 13:17
Installing Nvidia drivers on Debian testing 2021-10-11

Current (2021-10-11) Debian testing cannot install Nvidia drivers properly. There [bug report 994860], which contains [a patch].

Here are the steps I took to apply that patch and make things work.

Download the fix-kernel514.patch from this Gist.

Then run these commands:

$ sudo apt install nvidia-installer-cleanup glx-alternative-nvidia update-glx glx-diversions glx-alternative-mesa  nvidia-support nvidia-kernel-common  nvidia-modprobe xserver-xorg-core libvdpau1
@vmx
vmx / kernel.cu
Created August 25, 2021 20:18
Multiexp and FFT OpenCL/CUDA kernel
// Defines to make the code work with both, CUDA and OpenCL
//#ifdef __NVCC__
#ifdef __CUDACC__
#define DEVICE __device__
#define GLOBAL
#define KERNEL extern "C" __global__
#define LOCAL __shared__
#define GET_GLOBAL_ID() blockIdx.x * blockDim.x + threadIdx.x
#define GET_GROUP_ID() blockIdx.x
@vmx
vmx / download_files_seafile.sh
Last active February 25, 2024 22:42
Download files from password protected Seafile directory
#!/bin/sh
#set -o xtrace
# SPDX-FileCopyrightText: Volker Mische <[email protected]>
# SPDX-License-Identifier: MIT
# This script downloads files from Seafile from a password protected directory
# from the command line. It only downloads the files of the given directory,
# it's *not* recursing down directories.
#
@vmx
vmx / schedule.md
Last active June 8, 2021 23:02
FOSSGIS 2021 Schedule

FOSSGIS 2021 Schedule

2021-06-07

Bühne 1

@vmx
vmx / README.md
Last active May 22, 2021 16:37
Setup for the live-streaming at FOSSGIS 2021

Setup for the live-streaming at FOSSGIS 2021

The [FOSSGIS 2021] is using [OBS] for the live-streaming. The speakers are in a [Jitsi] room, they either present live or a pre-recorded video is played. The speakers will be available for a Q&A Session after the talk. A moderator will introduce the talk and also run the Q&A Session.

The person working in OBS will have the following setup:

  • [Chromium] works best with Jitsi
  • Bookmarklets to change the window titles
  • [Mute Tab Extension] as there will be several windows with Jitsi
@vmx
vmx / copy_files.sh
Created May 7, 2021 14:56
Seafile: copying directories that contain some files (for FOSSGIS 2021)
#!/bin/sh
#set -o xtrace
# SPDX-FileCopyrightText: Volker Mische <[email protected]>
# SPDX-License-Identifier: MIT
# Copies all sub-directories (direct ones, not deeper nested ones) which
# contain at least one file into another directory. It creates the target
# directory if it doesn't exist.
#
@vmx
vmx / combine_talks_speakers_upload_links.py
Created May 1, 2021 14:44
Upload links on Seafile for conference talks submitted to pretalx