Skip to content

Instantly share code, notes, and snippets.

View DavidPesticcio's full-sized avatar
🚀
¯\_(ツ)_/¯

David Pesticcio DavidPesticcio

🚀
¯\_(ツ)_/¯
View GitHub Profile
@DavidPesticcio
DavidPesticcio / syncthing-automerge.py
Created August 26, 2023 20:43 — forked from solarkraft/syncthing-automerge.py
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
import os
import time
import re
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def get_relative_path(path):
return os.path.relpath(path)
# Run the last command as root
sudo !!
# Serve current directory tree at http://$HOSTNAME:8000/
python -m SimpleHTTPServer
# Save a file you edited in vim without the needed permissions
:w !sudo tee %
# change to the previous working directory
cd -
# Runs previous command but replacing
^foo^bar
@DavidPesticcio
DavidPesticcio / setup-users.groovy
Created May 14, 2023 10:39 — forked from johnbuhay/setup-users.groovy
jenkins init.groovy.d script for configuring users
import jenkins.*
import hudson.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import hudson.plugins.sshslaves.*;
import hudson.model.*
import jenkins.model.*
import hudson.security.*
@DavidPesticcio
DavidPesticcio / vsc-settings.py
Created February 6, 2023 11:42 — forked from wonderbeyond/vsc-settings.py
script to export vsc settings
#!/usr/bin/env python3
from os import path
import tempfile
import subprocess
import datetime as dt
import click
@click.group()
def cli():
@DavidPesticcio
DavidPesticcio / github_multiple-accounts.md
Created January 5, 2023 20:26 — forked from JoaquimLey/github_multiple-accounts.md
How to Work with GitHub and Multiple Accounts

Step 1 - Create a New SSH Key

We need to generate a unique SSH key for our second GitHub account.

ssh-keygen -t rsa -C "your-email-address"

Be careful that you don't over-write your existing key for your personal account. Instead, when prompted, save the file as id_rsa_COMPANY. In my case, I've saved the file to ~/.ssh/id_rsa_work.

Step 2 - Attach the New Key

@DavidPesticcio
DavidPesticcio / pomodoro.sh
Created December 9, 2022 10:01 — forked from jameswpm/pomodoro.sh
Minimalistic Pomodoro Timer
#!/bin/bash
#
# Minimalistic_Pomodoro_Timer
#
# Based on the SU answer found here: https://superuser.com/questions/224265/pomodoro-timer-for-linux/669811#669811
#
# Tested in Ubuntu 16.04 and Arch
pomodorotime () {
notify-send "Time to Work" "Focus" -u normal -a 'Pomodoro' -i $HOME/Documentos/icon.png
paplay /usr/share/sounds/freedesktop/stereo/window-attention.oga
@DavidPesticcio
DavidPesticcio / pass.md
Created November 26, 2022 13:54 — forked from abtrout/pass.md
Using password-store with git repository synching

Password-store keeps your passwords (or any other sensitive information) saved in GnuPG encrypted files organized in ~/.password-store. For more information about GPG, consult the GNU Privacy Handbook.

Getting started

To get started, install pass and generate a keypair.

$ brew install pass
$ gpg --gen-key
$ gpg --list-keys
@DavidPesticcio
DavidPesticcio / monokai.md
Created May 10, 2022 21:11 — forked from r-malon/monokai.md
Monokai colors in RGB and HEX format, taken from Sublime Text 3

Monokai Colors in RGB and HEX format


  • Background: (46, 46, 46); #2e2e2e
  • Comments: (121, 121, 121); #797979
  • White: (214, 214, 214); #d6d6d6
  • Yellow: (229, 181, 103); #e5b567
  • Green: (180, 210, 115); #b4d273
  • Orange: (232, 125, 62); #e87d3e
  • Purple: (158, 134, 200); #9e86c8
@DavidPesticcio
DavidPesticcio / create_ssl_using_terraform.md
Created March 13, 2022 09:55 — forked from riveraja/create_ssl_using_terraform.md
Create SSL certificates using Terraform

This post will guide you in creating TLS keys for Vault with Terraform using terraform-google-vault private-tls-cert submodule [https://registry.terraform.io/modules/hashicorp/vault/google/0.0.4/submodules/private-tls-cert].

We will need to download Hashicorp Terraform tool from https://www.terraform.io/downloads.html and then unzip the compressed file:

# wget https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_linux_amd64.zip
--2018-06-18 12:19:33--  https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.1.183, 151.101.65.183, 151.101.129.183, ...
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.1.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
@DavidPesticcio
DavidPesticcio / README.md
Created February 11, 2022 20:19 — forked from rowleyaj/README.md
Terraform S3 Backend

Testing the S3 backend + DynamoDB locking

  1. Clone this gist and change directory to it
  2. Rename run-2nd.tf to an alternative file ending to prevent it being run.
  3. terraform init
  4. Normally you would plan and save to a file but for this example we're going to just apply directly terraform apply
  5. Rename run-2nd.tf back to it's original name
  6. The backend has changed so requires a new terraform init
  7. terraform apply