Skip to content

Instantly share code, notes, and snippets.

View jRimbault's full-sized avatar
💭
🦀🐍TS C#

Jacques Rimbault jRimbault

💭
🦀🐍TS C#
View GitHub Profile
@castarco
castarco / TypedRegistryPattern.ts
Last active February 9, 2022 13:13
A "new" pattern to create fully-typed registries/containers!
// This first file contains the first iteration of this pattern. It's already
// nice, but not enough for full-fledged IoC libraries.
// There's a second file in this same gist that goes one step further, although,
// for now, it still needs some extra polish.
// -----------------------------------------------------------------------------
// First: the two main interfaces.
// They are the core of the pattern.
// -----------------------------------------------------------------------------
export interface WritableRegistry {
@shakna-israel
shakna-israel / LetsDestroyC.md
Created January 30, 2020 03:50
Let's Destroy C

Let's Destroy C

I have a pet project I work on, every now and then. CNoEvil.

The concept is simple enough.

What if, for a moment, we forgot all the rules we know. That we ignore every good idea, and accept all the terrible ones. That nothing is off limits. Can we turn C into a new language? Can we do what Lisp and Forth let the over-eager programmer do, but in C?


@KodrAus
KodrAus / Profile Rust on Linux.md
Last active November 14, 2023 17:19
Profiling Rust Applications

Profiling performance

Using perf:

$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg

NOTE: See @GabrielMajeri's comments below about the -g option.

@dragon788
dragon788 / longwindedname.md
Created November 25, 2016 23:39
Restore rEFInd as default boot manager from Windows after updates

After losing access to rEFInd yet again (Windows 10 Anniversary Edition), I was able to find the proper invocation of BCDEdit thanks to a helpful person on StackOverflow. None of the Microsoft documentation mentions this, but you NEED single quotes around {bootmgr} for sure if you are in the PowerShell shell, but possibly also if you are in the Command Prompt. This allowed me to add a new entry for rEFInd and I've had to do this multiple times so I know it works on Windows 10.

bcdedit /set {bootmgr} path \EFI\refind\refind_x64.efi 

becomes

bcdedit /set '{bootmgr}' path \EFI\refind\refind_x64.efi
@whophil
whophil / jupyter.service
Last active October 30, 2023 16:33 — forked from doowon/jupyter_systemd
A systemd script for running a Jupyter notebook server.
# After Ubuntu 16.04, Systemd becomes the default.
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/home/phil/Enthought/Canopy_64bit/User/bin/jupyter-notebook --config=/home/phil/.jupyter/jupyter_notebook_config.py
@DarwinAwardWinner
DarwinAwardWinner / python-bash-wrapper.py
Last active November 9, 2020 20:43
Put bash cluster setup code and python script in a single file
#!/bin/bash
# -*- mode:python -*-
#PBS -l nodes=1:ppn=8,mem=30gb
''''/bin/true
# This is bash code to set up the environment
echo "Hello from bash!"
echo "Args are: $@"
# Bash setup code ends here
python - "$@" <<EOF
''' # Python starts here '''
@codeinthehole
codeinthehole / osx_bootstrap.sh
Last active October 10, 2023 12:21
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@tadly
tadly / pacaur_install.sh
Last active August 30, 2023 13:15
A simple shell script to quickly / easily install "pacaur" on archlinux
#!/bin/sh
#
# !!! IMPORTANT !!!
# As of 2017-12-14, pacaur is unmaintained (https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144)
# For alternatives see the arch wiki: https://wiki.archlinux.org/index.php/AUR_helpers#Active
# pacaur seems to get occasional updates to fix breaking changes due to pacman updates though.
#
# If you are new to arch, I encourage you to at least read and understand what
# this script does befor blindley running it.
# That's why I didn't make a one-liner out of it so you have an easier time