Skip to content

Instantly share code, notes, and snippets.

View GuillaumeDesforges's full-sized avatar
🚀

Guillaume Desforges GuillaumeDesforges

🚀
  • Tweag
  • Paris
View GitHub Profile
[arsleust@poseideep:~/nixpkgs]$ nix-shell default.nix -A haskell.packages.ghc883.lsp-test_0_11_0_2
[nix-shell:~/nixpkgs]$ genericBuild
setupCompilerEnvironmentPhase
Build with /nix/store/kvjyz9rzf231kdls2z2nz2g8xlfkgi8r-ghc-8.8.3.
unpacking sources
unpacking source archive /nix/store/wfmqpsyq3qv9j9sf656x0psgpsv8hnfj-lsp-test-0.11.0.2.tar.gz
source root is lsp-test-0.11.0.2
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file lsp-test-0.11.0.2/test/Test.hs
patching sources
@GuillaumeDesforges
GuillaumeDesforges / shell.nix
Created January 11, 2021 16:08
A simple Nix shell to use a Python environment using pip (convenient for NixOS workstations)
let
pkgs = import <nixpkgs> {};
python-env = pkgs.python38.withPackages (pp: with pp; [ pip wheel cython ]);
in
pkgs.mkShell {
buildInputs = [
python-env
];
@GuillaumeDesforges
GuillaumeDesforges / observable.py
Created January 19, 2021 14:59
simple Python observable implementation
T = TypeVar('T')
class Observable(Generic[T]):
def __init__(self, value: T) -> None:
self.value: T = value
# list of callable items
self.listeners: List[Callable[[T], Any]] = []
def update(self, new_value: T) -> None:
self.value = new_value
@GuillaumeDesforges
GuillaumeDesforges / .vscode_launch.json
Last active February 4, 2021 06:05
Simplest use of TypeScript for node development with VS Code
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Run server (dev)",
"type": "node-terminal",
"request": "launch",

Cours git - ENPC IMI 2021 - TP

Introduction

La pratique se fait en binôme, avec 2 ordinateurs par binôme (1 ordinateur par personne).

L'objectif est de montrer comment git permet de travailler collaborativement, et comment gérer les conflits lors de l'intégration des changements distants.

Dans ce TP nous abordons les notions suivantes:

for dir in ~/.vscode-server*/bin/*
do
node=$dir/node
echo Fixing $node
rm -v $node
ln -vs $(which node) $node
rm -vf $dir/vscode-remote-lock*
done
GCCLIB=$(dirname $(gcc -print-file-name=libstdc++.so.6))
@GuillaumeDesforges
GuillaumeDesforges / nixos_python_patch_venv_bins.md
Last active February 11, 2024 00:54
How to: make Python dependencies installed via pip work on NixOS

EDIT: check out fix-python instead, make Python run "as usual" on NixOS!

How to: make Python dependencies installed via pip work on NixOS

The issue

  • You are using NixOS
  • You start working on a Python project
  • You manage the dependencies in a classic Python virtual environment using pip or poetry
curl -s 'https://graphics.afpforum.com/data/presidential-fr-2022-live-constantes/communes_codes.json' | jq -c '.[]' \
| while read commune_dict
do
code=$(echo "$commune_dict" | jq -r '.c')
nom=$(echo "$commune_dict" | jq -r '.n')
curl -sq "https://graphics.afpforum.com/data/presidential-fr-2022-live-results/resultats1/communes/IR1_$code.json" \
| jq --arg code "$code" -c '.lesResultats | map({key: .individuNom, value: .resPourCent}) | from_entries | . + {code: $code}' \
>> "resultats.json"
done
# usage:
# NIXPKGS_FLAKE_REF="github:nixos/nixpkgs/master" nix eval --json --file "./nixpkgs-graph.nix"
let
nixpkgsFlakeRef = builtins.getEnv "NIXPKGS_FLAKE_REF";
pkgs = import (builtins.getFlake nixpkgsFlakeRef) { };
in
with pkgs.lib;
@GuillaumeDesforges
GuillaumeDesforges / kitty_wslg.md
Last active January 18, 2023 19:57
Instructions to get a kitty shortcut on Windows via WSL and WSLg for NixOS-WSL

Get a kitty shortcut on Windows via WSL and WSLg for NixOS-WSL

Pre-requisite

  • have WSLg installed
  • use NixOS-WSL
  • have bash as part of your system packages (just check /run/current-system/sw/bin/bash exists)

First, add kitty to your home-manager profile.