Skip to content

Instantly share code, notes, and snippets.

@gnthibault
gnthibault / search_for_branch_in_all_dirs.sh
Created June 13, 2024 09:55
Search branch name is all subdirectories. Espace specific bash color character from ls
for i in $(ls -d */); do echo "$i"; cd $(echo "$(pwd)/$i" | sed -e $'s/\x1b\[[0-9;]*m//g'); git branch | grep BRANCH_NAME_TO_SEARCH ;cd ..; done
@gnthibault
gnthibault / utm_basic_install.sh
Last active June 12, 2024 08:44
Install default setup in ubuntu when ran into UTM, qemu based virtualization
#!/bin/bash
# Install prerequisites
sudo apt install -y ubuntu-desktop
sudo apt install -y qemu-guest-agent, spice-vdagent, spice-webdavd, davfs2
# Check if spice vdagent is enabled to get right click/clipboard working through utm
sudo systemctl start spice-vdagent
sudo systemctl enable spice-vdagent
sudo systemctl status spice-vdagent
@gnthibault
gnthibault / df_pydantic_validate.ipynb
Created April 17, 2023 07:20 — forked from niloch/df_pydantic_validate.ipynb
DataFrame Validation with Pydantic (including self validating dataframs)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Terraform v1.1.5
on linux_amd64
Initializing plugins and modules...
{"@level":"info","@message":"Terraform 1.1.5","@module":"terraform.ui","@timestamp":"2022-03-16T16:22:52.985423Z","terraform":"1.1.5","type":"version","ui":"1.0"}
{"@level":"info","@message":"module.gcloud.null_resource.gcloud_init: Plan to replace","@module":"terraform.ui","@timestamp":"2022-03-16T16:22:59.765190Z","change":{"resource":{"addr":"module.gcloud.null_resource.gcloud_init","module":"module.gcloud","resource":"null_resource.gcloud_init","implied_provider":"null","resource_type":"null_resource","resource_name":"gcloud_init","resource_key":null},"action":"replace","reason":"cannot_update"},"type":"planned_change"}
{"@level":"info","@message":"module.monitoring.module.stackdriver-alerting.google_monitoring_metric_descriptor.with_alert: Plan to replace","@module":"terraform.ui","@timestamp":"2022-03-16T16:22:59.766321Z","change":{"resource":{"addr":"module.monitoring.module.stackdriver-alerting.google_monitoring_metric_descriptor.with
# from https://stackoverflow.com/questions/16244969/how-to-tell-git-to-ignore-individual-lines-i-e-gitignore-for-specific-lines-of
# Run the following command:
git config --global filter.gitignore.clean "sed '/#gitignore$/d'"
# Now, either add a local file in .git/info/attributes
echo "*.extension_to_be_ignored filter=gitignore" > ./.git/info/attributes
# or write into a file that will be part of your code
echo "path_to_file_with_the_ignore_directive filter=gitignore" > ./.gitattributes
# From https://stackoverflow.com/a/64716636/2697831
#A stash entry is a special ref that points to a commit. So you can simply tag the commit.
git stash push -m "debug"
# after "git stash", tag the last entry
git tag debug stash@{0}
# later use the tag name
git stash apply debug
@gnthibault
gnthibault / search_modified_after_date.sh
Created November 14, 2021 23:19
Find all files recursively that have been modified after a certain date
# From https://stackoverflow.com/questions/848293/shell-script-get-all-files-modified-after-date
find . -newermt '2021-11-14T23:00:00'
@gnthibault
gnthibault / shrinkpdf.sh
Created December 13, 2020 14:31
Compress pdf
#!/bin/sh
# use with
#chmod +x ./shrinkpdf.sh
# ./shrinkpdf.sh ./testin.pdf ./testout.pdf
# http://www.alfredklomp.com/programming/shrinkpdf
# Licensed under the 3-clause BSD license:
#
# Copyright (c) 2014-2019, Alfred Klomp
# All rights reserved.
@gnthibault
gnthibault / npm-using-https-for-git.sh
Created December 1, 2020 18:28 — forked from taoyuan/npm-using-https-for-git.sh
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@gnthibault
gnthibault / gist:970d0d30644a5162cd4e9068f49151ef
Last active December 1, 2020 20:26
Safe access for multiple user on the same account on a linux machine
First task is to create your own token (generate new token):
https://github.com/settings/tokens
you can test it with
curl -u <token>:x-oauth-basic https://api.github.com/user
Then write it down to a specific file in home/user/subuser/.netrc , where you just created your directory
content of the file:
machine github.com