Skip to content

Instantly share code, notes, and snippets.

View 2gn's full-sized avatar
😞
Trying to make friends

2gn

😞
Trying to make friends
View GitHub Profile
# projects.toml file describing inputs for dream2nix
#
# To re-generate this file, run:
# nix run .#detect-projects $source
# ... where `$source` points to the source of your project.
#
# If the local flake is unavailable, alternatively execute the app from the
# upstream dream2nix flake:
# nix run github:nix-community/dream2nix#detect-projects $source
@2gn
2gn / fls.nix
Created March 15, 2023 21:38
packaging fls a fast ls alternative
{ lib
, stdenv
, fetchFromGitHub
, makeRustPlatform
, cmake
, pkg-config
, zlib
, Security
, libiconv
}:
@2gn
2gn / mozc-maclike
Last active January 1, 2023 03:59
mac-like mozc configuration
status key command
Composition Backspace Backspace
Composition Ctrl a MoveCursorToBeginning
Composition Ctrl Backspace Backspace
Composition Ctrl d MoveCursorRight
Composition Ctrl Down MoveCursorToEnd
Composition Ctrl e MoveCursorToBeginning
Composition Ctrl Enter Commit
Composition Ctrl f MoveCursorToEnd
Composition Ctrl g Delete
@2gn
2gn / cleanup.py
Created November 19, 2022 14:02
clean-up your abandoned projects
from subprocess import getoutput, run
directory_structure = getoutput(["ls", "-l"]).splitlines()
items_to_be_removed = []
for file_or_directory in directory_structure:
if file_or_directory != "cleanup.py":
yesOrNo = input("Do you need this (y/n) : "+file_or_directory)
if yesOrNo == "n":
@2gn
2gn / addext.sh
Last active September 5, 2022 13:32
Add extension to a file
# Usage: addext <original_filename> <file_extension>
# Example: addext useles s
# -> useles.s
mv $1 $1.$2
@2gn
2gn / nix.json
Created August 1, 2022 08:20
Nix snippet for vscode
{
// Place your snippets for nix here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@2gn
2gn / digin.sh
Created July 9, 2022 11:58
Dumbest way to "Dig in" to the directory.
mkdir -p $1;cd $1;$SHELL
@2gn
2gn / nix-purge.sh
Last active June 23, 2022 13:32
Delete all nix packages installed manually with nix-env command
# to save the list of packages installed, manually run:
# mkdir ~/tmp
# nix-env --query > ~/tmp/installedManually.list
# nix-env --uninstall ~/tmp/installedManually.list
# and then `cat` the file (~/tmp/installedManually.list) to see what to declare into your configuration.nix .
# if you want to remove without knowing what packages are currently installed, run the following command.
nix-env --uninstall `nix-env --query`
# use it as a normal shell script. I recommend you to place this file to somewhere on PATH.
# for example ( assuming you're using home-manager to configure your HOME ) :
# in your ~/.config/nixpkgs/home.nix
# {
# home = {
# sessionPath = [
# "$HOME/bin"
# ];
# };
# }