Skip to content

Instantly share code, notes, and snippets.

View amtoine's full-sized avatar
🦀

Antoine Stevan amtoine

🦀
View GitHub Profile
@amtoine
amtoine / .envrc
Created July 14, 2024 10:45
Direnv script to manage Python virtual environments
export PYTHONPATH=$(pwd)
RED='\033[0;31m'
GREEN='\033[0;32m'
PURPLE='\033[0;35m'
YELLOW='\033[1;33m'
NC='\033[0m'
error () { printf "${RED}[!]${NC} ${1}\n"; }
info () { printf "${GREEN}[~]${NC} ${1}\n"; }
@amtoine
amtoine / README.md
Last active October 12, 2023 12:02
List Git repos

💡 Note
the commands are not able to list bare repositories, because bare repositories do not have a .git/ directory, thus, the true_store needs to filter out the bare repositories

let true_store = $repos | where not bare | get path

💡 Note
the ls and glob Nushell commands do not have a --type directory option, so do not use it for fd and find

use the script

@amtoine
amtoine / README.md
Created October 6, 2023 17:33
List Gists of a GitHub user with the `unfold` command of Nushell

i wanted to play a bit with the new unfold command introduced by @hudclark in nushell/nushell#10489 and went with a gist listing task 😏

💡 Note
see nushell/nushell#10630

def "gh list gists" [
    user: string, # the user to list all the Gists of
    --page-size: int = 100, # the number of Gists per page
]: nothing -> table<url: string, forks_url: string, commits_url: string, id: string, node_id: string, git_pull_url: string, git_push_url: string, html_url: string, files record, public: bool, created_at: string, updated_at: string, description: string, comments: int, user: nothing, comments_url: string, owner: record<login: string, id: int, node_id: string, avatar_url: string, gravatar_id: string, url: string, html_url: string, followers_url: string, following_url: string, gists_url: string, starred_url: string, subscriptions_url: string, organizations_url: string, repos_url: string, events_url: string, received_events_url: 
@amtoine
amtoine / README.md
Last active October 4, 2023 17:11
Plot startup times of Nushell

Python Requirements

Simply pip install -r requirements.txt

How to compute startup times automatically

Put the following hook into your $env.config.hooks.env_change.PWD list

{|before, _|
    if $before == null {
        let file = $nu.home-path | path join ".local" "share" "nushell" "startup-times.nuon"
        if not ($file | path exists) {
@amtoine
amtoine / README.md
Created May 25, 2023 17:53
Nushell dependency graph

Nushell dependency graph

below is the dependency graph of the Nushell project

💡 Note
command to generate this, with the graphviz package

dot -T png -o nushell.png nushell.dot
@amtoine
amtoine / README.md
Created May 25, 2023 17:49
`arkworks-rs` dependency graph

arkworks-rs dependency graph

below is the dependency graph of the arkworks-rs ecosysten

💡 Note
command to generate this, with the graphviz package

dot -T png -o arkworks-rs.png arkworks-rs.dot
@amtoine
amtoine / README.md
Created May 6, 2023 08:43
compare HTTP files

compare HTTP files

def "http delta" [
    main: string
    target: string
    --page: bool
] {
    let path = ($nu.temp-path | path join (random uuid))
 mkdir $path
@amtoine
amtoine / README.md
Created May 6, 2023 08:43
auto update from HTTP file

auto update from HTTP file

def "http auto update" [
    target: string
    destination: path
    message: string
] {
    http get --raw $target | save --force $destination
 git add $destination
@amtoine
amtoine / README.md
Last active April 15, 2023 16:11
inspect all nushell issues

inspect all nushell issue

first issues.nuon

{
    issues: (
        gh -R nushell/nushell issue list --limit (inf | into int) --json number
        | from json
        | get number
 | reverse
@amtoine
amtoine / README.md
Created April 12, 2023 17:07
a wrapper around the `gstat` plugin for `nushell`

a wrapper around the gstat plugin for nushell

this wrapper removes the 0 entries in the gstat output 👍

Note
see nu_plugin_gstat

# wrapper around the [`gstat`](https://github.com/nushell/nushell/tree/main/crates/nu_plugin_gstat) plugin
def gst [