Skip to content

Instantly share code, notes, and snippets.

View enkerewpo's full-sized avatar
:octocat:
foxing

wheatfox enkerewpo

:octocat:
foxing
View GitHub Profile
@plmercereau
plmercereau / raspberry-pi-zero-2.nix
Last active May 7, 2025 19:12
Nix module to create SD images for Rasperry Pi Zero 2 W
{ config, lib, pkgs, ... }:
{
imports = [
<nixpkgs/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix>
./sd-image.nix
];
system.stateVersion = "23.11";
# Pi Zero 2 struggles to work without swap
sdImage.swap.enable = true;
@itewqq
itewqq / vscode-for-linux-kernel.md
Created February 19, 2023 14:37
Configure vscode for linux kernel source code
  1. Disable or uninstall the official C/C++ plugin.
  2. Install the clangd plugin.
  3. Build the kernel with clang:
/path/to/kernel_source$ make CC=clang defconfig
/path/to/kernel_source$ make CC=clang -j16
  1. Generate the compile_commands.json:
/path/to/kernel_source$ python ./scripts/clang-tools/gen_compile_commands.py
@zxubian
zxubian / clion-makefile-setup.md
Last active August 16, 2023 03:34
Running & Building a C Makefile Project with CLion & WSL (January 2022)

Running & Building a C Makefile Project with CLion & WSL (January 2022)

  • Set CLion Toolchain to WSL
    • Settings/Build, Execution & Deployment/Toolchains
    • Make sure all checks pass
    • If necessary, install C build tools on WSL side sudo apt-get install build-essential
  • From CLion, use File/Open... -> your MakeFile -> "Open as Project" -Note: if your MakeFile does not contain an "all" target, the CLion Makefile plugin thing might get angry and not parse any of the other targets
  • Go to "Edit Configurations" (on the upper-right)
@wuct
wuct / deadlock.rs
Created June 29, 2020 11:49
A deadlock example in Rust with threads and `Mutex`
use std::sync::{Arc, Mutex};
use std::thread;
fn main() {
let a = Arc::new(Mutex::new(0));
let b = Arc::new(Mutex::new(0));
let mut handles = vec![];
{
let a = Arc::clone(&a);
@sgherbst
sgherbst / notes.md
Created March 11, 2019 13:32
Installing Verilator on Windows 10 using a fresh MSYS2 install
  1. Download and install MSYS2: https://sourceforge.net/projects/msys2/
  2. Open MSYS2 shell and run pacman -Syu
  3. After some time you will be prompted to close the MSYS2 shell by clicking the "X" button, which you should do :-)
  4. Relaunch MSYS2 shell and run pacman -Su
  5. Install the required packages for Verilator:
> pacman -S git make autoconf gcc flex bison man perl
  1. Clone the Verilator source and build the latest stable release:
@Maarten-Wijnants
Maarten-Wijnants / gist:ec4a3e9e65504e7e67a0873dca353871
Last active March 16, 2020 15:33
Ubuntu 14.04 Asterisk server installation
https://www.odoo.com/apps/modules/8.0/crm_voip/
# Install asterisk server on Ubuntu 14.04
# 1. Install dependencies
sudo apt-get update
sudo apt-get install wget
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install ncurses-dev
@alexklibisz
alexklibisz / lockwait.c
Last active November 7, 2023 12:15
A simple example for using pthread_cond_wait() and pthread_cond_signal() with mutexes and conditional variables.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
/* compile with gcc -pthread lockwait.c */
pthread_cond_t cv;
pthread_mutex_t lock;
@lattera
lattera / .vimrc
Created August 11, 2014 11:54
vimrc for FreeBSD development
" Modeline and Notes {
" vim: set foldmarker={,} foldlevel=0 spell:
" }
" Basics {
set nocompatible " explicitly get out of vi-compatible mode
set noexrc " don't use local version of .(g)vimrc, .exrc
set background=dark " we plan to use a dark background
set cpoptions=aABceFsmq
" |||||||||
@thinkerbot
thinkerbot / public_enc_example.sh
Created November 19, 2010 04:56
Public-key encryption example using OpenSSL
#!/bin/bash
#
# Public-Key Encryption and Decryption
# * http://www.openssl.org/
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/
#
# Mac OS X 10.6.4
# OpenSSL 0.9.8l 5 Nov 2009
# Generate keys