Skip to content

Instantly share code, notes, and snippets.

View artynet's full-sized avatar

Arturo Rinaldi artynet

View GitHub Profile
@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)
#
@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 / 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 you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
@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 / go-os-arch.md
Created May 18, 2019 00:19 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.8.3 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • android
  • darwin
@artynet
artynet / add.sh
Created May 1, 2019 18:48 — forked from ArseniyShestakov/add.sh
My compiler alternatives
# Cleanup old alternatives
update-alternatives --remove-all cc
update-alternatives --remove-all c++
update-alternatives --remove-all gcc
update-alternatives --remove-all g++
update-alternatives --remove-all clang
update-alternatives --remove-all clang++
update-alternatives --remove-all icc
update-alternatives --remove-all icc++
@artynet
artynet / Setup GCC and CLANG Toolchains.md
Created May 1, 2019 18:48 — forked from bhaskarvk/Setup GCC and CLANG Toolchains.md
Proper GCC (vers. 5/6/7) & LLVM/CLANG (vers. 4/5) Toolchain Setup on Ubuntu/Linux Mint

This approach uses update-alternatives to manage GCC and LLVM/CLANG C/C++ compiler toolchains. Although tested on Linux Mint 18.3, this approach should work on any Debian based distro or for that matter any Linux distro with update-alternatives support, provided the packages are installed correctly.

There are 3 files

  • gcc-alternatives.sh installs GCC versions 5/6/7 and sets up alternatives for gcc/g++/cpp/gfortran.
  • llvm-clang-alternatives.sh installs LLVM and CLANG versions 4/5 and sets up alternatives for various LLVM and CLANG programs including clang and clang++.
  • cc-alternatives.sh sets up alternatives for the cc, cxx, and the ld commands. This script can be used to change systemwide default compiler/linker combination to either GCC or CLANG.

Once these scripts are run you can change the system GCC/CLANG versions by running sudo update-alternatives --config gcc|clang. To change the default compiler/linker combo used by t

@artynet
artynet / happy_git_on_osx.md
Created April 4, 2019 21:00 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@artynet
artynet / update_openwrt_rootfs.sh
Created March 30, 2019 00:44 — forked from il-katta/Dockerfile
script to update katta/openwrt-rootfs docker image
#!/bin/bash
set -xe
curl -sL https://downloads.lede-project.org/snapshots/targets/x86/generic/openwrt-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:lede-latest
docker push katta/openwrt-rootfs:lede-latest
curl -sL http://archive.openwrt.org/snapshots/trunk/x86/generic/openwrt-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:latest
docker push katta/openwrt-rootfs:latest
curl -sL http://downloads.openwrt.org/releases/18.06.1/targets/x86/generic/openwrt-18.06.1-x86-generic-generic-rootfs.tar.gz | docker import - katta/openwrt-rootfs:18.06.1
docker push katta/openwrt-rootfs:18.06.1
@artynet
artynet / Makefile
Created March 29, 2019 20:12 — forked from garyachy/Makefile
Linux kernel module makefile
ifeq ($(KERNELRELEASE),)
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules EXTRA_CFLAGS="-g -DDEBUG"
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install