Skip to content

Instantly share code, notes, and snippets.

View con-f-use's full-sized avatar
💭
😱

con-f-use

💭
😱
  • A University, An IT Firm
  • Europe
View GitHub Profile
@oguzalb
oguzalb / arrowfunc.patch
Created July 21, 2023 14:08
adding arrow functions to Python grammar
diff --git a/Grammar/Tokens b/Grammar/Tokens
index 618ae81..29bcfeb 100644
--- a/Grammar/Tokens
+++ b/Grammar/Tokens
@@ -11,6 +11,7 @@ RPAR ')'
LSQB '['
RSQB ']'
COLON ':'
+FUNC_SIGN '=>'
COMMA ','
# Import python packages which are installed in the nix store
# Note you NEED this if you install it via environment.systemPackages
# E.g environment.systemPackages = with pkgs; [ python27Packages.tensorflowWithCuda ]
# You DON'T NEED this if you do it like this:
# python-with-my-packages = pkgs.python27.withPackages (ps: with ps; [ tensorflowWithCuda]);
# environment.systemPackages = [ python-with-my-packages ]
import sys
@caadar
caadar / autologin-tty-nixos.org
Last active October 23, 2023 00:34
How to make a user autologin at the console on NixOS

Autologin a user at the console (NixOS)

Problem

NixOS provide services.mingetty.autologinUser option, but it can’t be used for the specific TTY.

Minimal working example

TTY1 and user “guest”:

@lheckemann
lheckemann / 0-readme.md
Last active March 11, 2024 13:11
Expression for a buildEnv-based declarative user environment.

Expression for a buildEnv-based declarative user environment

This is one way of managing your user profile declaratively.

Alternatives include:

  • an attrset-based nix-env-based environment, installed using nix-env -ir rather than nix-env --set. LnL has an overlay which shows a way of doing this.
  • home-manager, which provides NixOS-like config for your $HOME

Note that this is incompatible with regular imperative use of nix-env, e.g. nix-env -iA nixpkgs.hello. It has the advantage of allowing the installation of multiple outputs of the same package much better than nix-env's builtin profile builder does.

@nic0-lab
nic0-lab / gist:9ad496ef8ba0cc7bd19c4689499ef646
Created June 4, 2017 15:33
Config Vim as a Python IDE by Martin Brochhaus
" Sample .vimrc file by Martin Brochhaus
" Presented at PyCon APAC 2012
" ============================================
" Note to myself:
" DO NOT USE <C-z> FOR SAVING WHEN PRESENTING!
" ============================================
@martijnvermaat
martijnvermaat / nixos.md
Last active March 24, 2024 11:42
Installation of NixOS with encrypted root
@benley
benley / nix-profile.sh
Created January 6, 2015 07:57
tweaked nix login script
# Heavily cribbed from the equivalent NixOS login script.
# This should work better with multi-user nix setups.
export NIXPKGS_CONFIG="/etc/nix/nixpkgs-config.nix"
export NIX_OTHER_STORES="/run/nix/remote-stores/*/nix"
export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
export NIX_PROFILES="/nix/var/nix/profiles/default $HOME/.nix-profile"
export NIX_PATH="/nix/var/nix/profiles/per-user/root/channels"
export PATH="$HOME/.nix-profile/bin:$HOME/.nix-profile/sbin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:$PATH"
@kennethlove
kennethlove / books.py
Last active December 5, 2018 00:26
Smarter book object.
class Book:
title = ''
pages = 0
def __init__(self, title='', pages=0):
self.title = title
self.pages = pages
def __add__(self, other):
"""Control adding two Books together or a Book and a number"""
@lucabrunox
lucabrunox / autotools.nix
Last active December 2, 2021 18:16
Nix pill 12
pkgs: attrs:
with pkgs;
let defaultAttrs = {
builder = "${bash}/bin/bash";
args = [ ./builder.sh ];
setup = ./setup.sh;
baseInputs = [ gnutar gzip gnumake gcc binutils coreutils gawk gnused gnugrep patchelf findutils ];
buildInputs = [];
system = builtins.currentSystem;
};
@chronossc
chronossc / devpi-server-article.md
Created November 25, 2013 04:00
Article/how to about how install devpy-server (not finished yet)

dev-pi install howto

This guide follow instructions in the devpi quickstart server guide. We will install in own user home using virtualenvs, than, will setup a nginx instance. Server used here is Ubuntu Server 12.04 LTS in one virtualbox instance.

Create devpi user

root ~ # useradd -m -U -s /bin/bash devpi
root ~ # passwd devpi