Skip to content

Instantly share code, notes, and snippets.

@chaiyujin
chaiyujin / ubuntu_update_booting_kernel.md
Created December 8, 2020 12:42
Ubuntu: Install Kernel and Set GRUB Default Kernel

Ubuntu: Install Kernel and Set GRUB Default Kernel

Install Kernel

Install the default kernel:

sudo apt install linux-generic

Set GRUB Default Kernel

  1. Find entrance from /boot/grub/grub.cfg
    • Get the $menuentry_id_option:
@larsch
larsch / archlinuxarm-on-nanopi-r2s.md
Created October 10, 2020 10:48
Installing Arch Linux AArch64 on the NanoPi R2S

Installing Arch Linux AArch64 on the NanoPi R2S

There is current no support for the NanoPi R2S in ArchLinuxArm, but it's possible to run it using the generic aarch64 installation.

Prepare sd-card/image

  1. Copy bootloader and uBoot from an armbian image using for the NanoPi R2S using dd (sectors 32 to 32767) everything before the partition, except the partition table).
  2. Create an ext4 partition on /dev/mmcblk0p1 at offset of 32768 sectors (16384 KiB):
Device         Boot Start      End  Sectors  Size Id Type
@zoilomora
zoilomora / README.md
Last active April 24, 2024 12:42
How to disable cloud-init in Ubuntu

How to disable cloud-init in Ubuntu

Prevent start

  • Create an empty file to prevent the service from starting

      sudo touch /etc/cloud/cloud-init.disabled
    

Uninstall

@alfakini
alfakini / events.py
Last active August 15, 2021 05:40
Filesystem events monitoring with Python [events.py]
import os
from PIL import Image
from PIL.ImageOps import grayscale
from watchdog.events import RegexMatchingEventHandler
class ImagesEventHandler(RegexMatchingEventHandler):
THUMBNAIL_SIZE = (128, 128)
IMAGES_REGEX = [r".*[^_thumbnail]\.jpg$"]
def __init__(self):
@projetsdiy
projetsdiy / micropython i2c scanner
Last active May 3, 2024 19:45
Micropython i2c scanner
# Scanner i2c en MicroPython | MicroPython i2c scanner
# Renvoi l'adresse en decimal et hexa de chaque device connecte sur le bus i2c
# Return decimal and hexa adress of each i2c device
# https://projetsdiy.fr - https://diyprojects.io (dec. 2017)
import machine
i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4))
print('Scan i2c bus...')
devices = i2c.scan()
@dglaude
dglaude / unicorn_hat_for_ESP8266_micro.py
Last active June 2, 2020 10:51
Modifying Pimoroni Unicorn HAT library for use in microPython on ESP8266
### microPython ESP8266 documentation from http://docs.micropython.org/en/latest/esp8266/esp8266/quickref.html#neopixel-driver
###
###from machine import Pin
###from neopixel import NeoPixel
###
###pin = Pin(0, Pin.OUT) # set GPIO0 to output to drive NeoPixels
###np = NeoPixel(pin, 8) # create NeoPixel driver on GPIO0 for 8 pixels
###np[0] = (255, 255, 255) # set the first pixel to white
###np.write() # write data to all pixels
###r, g, b = np[0] # get first pixel colour
@Brainiarc7
Brainiarc7 / VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
Last active March 26, 2024 18:18
This gist contains instructions on setting up FFmpeg and Libav to use VAAPI-based hardware accelerated encoding (on supported platforms) for H.264 (and H.265 on supported hardware) video formats.

Using VAAPI's hardware accelerated video encoding on Linux with Intel's hardware on FFmpeg and libav

Hello, brethren :-)

As it turns out, the current version of FFmpeg (version 3.1 released earlier today) and libav (master branch) supports full H.264 and HEVC encode in VAAPI on supported hardware that works reliably well to be termed "production-ready".

@luca-m
luca-m / virustotal_upload
Created May 26, 2014 19:01
Upload a sample to VirusTotal and pretty print the report. All in a handy alias.
#
# Upload a sample to VirusTotal and pretty print the report. All in a handy alias.
#
# Dependecies:
#
# * python > 2.7
# * pip install Pygments==1.4
# * curl
# * VirusTotal API key
#