Skip to content

Instantly share code, notes, and snippets.

View gwennlbh's full-sized avatar
🐟
さかなあああ〜

Gwenn Le Bihan gwennlbh

🐟
さかなあああ〜
View GitHub Profile
#!/usr/bin/env ruby
require "pathname"
require "json"
require "tty-prompt"
require "pastel"
conventional = false
LABEL_TO_CONVENTIONAL = {
bug: :fix,
import requests
from subprocess import run
import json
def create_github_issue(iid: int, title: str, body: str, open = True):
# make sure the issue we will create will have the same number as the one in GitLab
github_last_issue = json.loads( run(["gh", "issue", "ls", "--state", "all", "--limit", "1", "--json", "number"], capture_output=True).stdout.decode('utf-8'))
previous_iid_from_github = github_last_issue[0]['number'] if len(github_last_issue) > 0 else 0
if previous_iid_from_github != iid-1:
print(f"Previous issue in GitHub has number {previous_iid_from_github}, while the next one should be {iid}.")
mutation DeleteContribution($user: UID!, $option: LocalID!) {
deleteContribution(user: $user, option: $option) {
...MutationErrors
... on MutationDeleteContributionSuccess {
data {
...List_UserContributions_Pending_remove
...List_UserContributions_Paid_remove
...List_UserContributions_Options_insert
id
}
@gwennlbh
gwennlbh / net7.d2
Last active July 12, 2024 14:59
infra net7
internet
renater
cluster proxmox: {
hyperviseurs: {
iota
sigma
omega
}
#!/usr/bin/env ruby
if ["-h", "--help"].include? ARGV[0]
puts "Usage: #{__FILE__}"
puts " Include all recipes"
puts " #{__FILE__} including recipe1 recipe2 ..."
puts " Only include the specified recipes"
puts " #{__FILE__} excluding recipe1 recipe2 ..."
puts " Exclude the specified recipes"
exit 0
function up
paru
pnpm up -g
rustup update
gup update
pipx upgrade-all
opam upgrade
gh extension upgrade --all
cargo install-update -a
gem update
#!/usr/bin/env ruby
require "pathname"
require "json"
require "tty-prompt"
require "pastel"
conventional = true
LABEL_TO_CONVENTIONAL = {
bug: :fix,
@gwennlbh
gwennlbh / close-issue.rb
Last active April 30, 2022 20:50
A small ruby executable that commits staged changes, computing the commit message so that it closes the issue and follows the Gitmoji convention. Execute it inside of a github repo, or pass owner/repo as an argument to specify a repo explicitly.
#!/usr/bin/env ruby
# Install dependencies:
# - gem install tty-prompt
# - gem install pastel
# - https://cli.github.com
# - npm install --global gitmoji-cli; gitmoji -u
# (just to get the cached list of gitmojis at ~/.gitmoji/gitmojis.json,
# you could write out that file yourself and not install gitmoji-cli)
import (
"strings"
jsoniter "github.com/json-iterator/go"
"unicode"
)
// Usage: put
//
// json := jsoniter.ConfigFastest
// setJSONNamingStrategy(lowerCaseWithUnderscore)