Skip to content

Instantly share code, notes, and snippets.

@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
@risicle
risicle / netplan-to-nixos.jq
Created May 2, 2021 21:18
jq expression to turn netplan yaml configs into nixos network configurations, supporting bonding and vlans
{
systemd: {
network: {
netdevs: (
.network.ethernets | with_entries(.value |= {
netdevConfig: {Name: ."set-name"},
matchConfig: {MACAddress: .match.macaddress}
})
)
}
@fleimgruber
fleimgruber / edit-indirect-rst.el
Created August 22, 2017 19:53
Sketch of using edit-indirect to edit docstrings in rst
(use-package edit-indirect)
(defun edit-indirect-rst-set-mode (_parent _beg _end)
(rst-mode))
(setq edit-indirect-guess-mode-function #'edit-indirect-rst-set-mode)
(defun edit-indirect-rst-remove-spaces()
(save-excursion
(beginning-of-buffer)
self: super:
{
# Install overlay:
# $ mkdir -p ~/.config/nixpkgs/overlays
# $ curl https://gist.githubusercontent.com/LnL7/570349866bb69467d0caf5cb175faa74/raw/3f3d53fe8e8713ee321ee894ecf76edbcb0b3711/lnl-overlay.nix -o ~/.config/nixpkgs/overlays/lnl.nix
userPackages = super.userPackages or {} // {
# Example:
hello = self.hello;
@joepie91
joepie91 / vpn.md
Last active June 18, 2024 07:25
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
#!/bin/bash
if [ ! -f /usr/bin/uidmapshift ]; then
wget https://bazaar.launchpad.net/~serge-hallyn/+junk/nsexec/download/head:/uidmapshift.c-20121030152620-2zy9rkac9y6htoia-8/uidmapshift.c
gcc -o uidmapshift uidmapshift.c
sudo mv uidmapshift /usr/bin/uidmapshift
rm -f uidmapshift.c
fi
uid=$(grep $USER /etc/subuid | cut -d : -f 2)
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@christianjianelli
christianjianelli / myJSONModel.js
Created December 5, 2012 19:44
Extending SAPUI5 JSON Model
jQuery.sap.require("sap.ui.model.json.JSONModel");
sap.ui.model.json.JSONModel.extend("myJSONModel", {
//declare our new method including two new parameters fnSuccess and fnError, our callback functions
loadDataNew: function(sURL, fnSuccess, fnError, oParameters, bAsync, sType, bMerge, bCache){
var that = this;
if (bAsync !== false) {
@agnoster
agnoster / README.md
Last active April 6, 2024 22:35
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 17, 2024 23:43
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname