Skip to content

Instantly share code, notes, and snippets.

View artynet's full-sized avatar

Arturo Rinaldi artynet

View GitHub Profile
@artynet
artynet / find-replace-in-file-recursive-regex.py
Created May 24, 2020 21:53 — forked from glowinthedark/find-replace-in-file-recursive-regex.py
Recursively find and replace text in files under a specific folder with colorized preview of changed data in dry-run mode
#!/usr/bin/env python
"""
Recursively find and replace text in files under a specific folder with preview of changed data in dry-run mode
============
Example Usage
---------------
**See what is going to change (dry run):**
@artynet
artynet / gist:7812287783985d97e438b3dc502c4042
Created June 9, 2020 15:33 — forked from yano3/gist:1378948
git commit --amend --reset-author
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email [email protected]
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
#############
### ILIAD ###
#############
config interface 'wan3g'
option ifname 'modem'
option proto 'qmi'
option apn 'iliad'
option pincode '1234'
option autoconnect '1'
#!/bin/bash
# URL : https://stackoverflow.com/questions/48400287/git-format-patch-for-all-the-commits-to-a-file
COUNTER=${2};
for c in `git log --format="%H" -- ${1} | head -n ${2}`;do
git format-patch --start-number=$COUNTER "$c^1".."$c" -o patches
let COUNTER=COUNTER-1
done
@artynet
artynet / reset_usb_device.py
Created March 24, 2022 16:16 — forked from willstott101/reset_usb_device.py
Disable and enable a specific USB device.
#! /usr/bin/python3
import os
import argparse
from time import sleep
PATH = '/sys/bus/usb/devices/'
def reset_device(key, value, coerce, sleep_time):
for device_dir, dirs, files in os.walk(PATH, followlinks=True):
if device_dir != PATH:
@artynet
artynet / ro-root.sh
Created June 8, 2022 14:24 — forked from paul-ridgway/ro-root.sh
A scrip to replace the default RPi init to create and chroot to an overlayfs-backed root
#!/bin/sh
# Read-only Root-FS for Raspian using overlayfs
# Version 1.1:
# Changed to use /proc/mounts rathern than /etc/fstab for deriving the root filesystem.
#
# Version 1:
# Created 2017 by Pascal Suter @ DALCO AG, Switzerland to work on Raspian as custom init script
# (raspbian does not use an initramfs on boot)
#