Skip to content

Instantly share code, notes, and snippets.

View BenoitDuffez's full-sized avatar

Benoit Duffez BenoitDuffez

  • Kerlink
  • Los Angeles greater area, CA, USA
View GitHub Profile
@florina-muntenescu
florina-muntenescu / BaseDao.kt
Last active January 1, 2025 06:52
Use Dao inheritance to reduce the amount of boilerplate code - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@FrankWu100
FrankWu100 / 0000-Enable NETDEV Led Trigger.md
Last active January 20, 2022 22:01
Enable NETDEV Led Trigger

config nodes

/sys/class/leds/<led>/device_name

Specifies the network device name to monitor.

/sys/class/leds/<led>/interval

Specifies the duration of the LED blink in milliseconds. Defaults to 50 ms.

/sys/class/leds//link

@pyetti
pyetti / stream_transformer.dart
Created August 6, 2019 22:38
Stream transforms in Dart are too complicated and seem to require the below over and over, if it's not generic. The file below should be useable in any Dart project to transform streams.
import 'dart:async';
/*
* https://api.flutter.dev/flutter/dart-async/Stream/Stream.eventTransformed.html
*
* <S, T>
* S ==> Snapshot type (DocumentSnapshot, QuerySnapshot, et. al.)
* T ==> The type to be returned (Event, List<EventMedia>, et. al.)
*
* This should probably never need to change. It seems to work pretty well.
@mrpeardotnet
mrpeardotnet / PVE-HP-ssacli-smart-storage-admin.md
Created November 25, 2019 22:10
HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

Why use HP Smart Storage Admin CLI?

You can use ssacli (smart storage administrator command line interface) tool to manage any of supported HP Smart Array Controllers in your Proxmox host without need to reboot your server to access Smart Storage Administrator in BIOS. That means no host downtime when managing your storage.

CLI is not as convenient as GUI interface provided by BIOS or desktop utilities, but still allows you to fully manage your controller, physical disks and logical drives on the fly with no Proxmox host downtime.

ssacli replaces older hpssacli, but shares the same syntax and adds support for newer servers and controllers.

Installation

@lkraider
lkraider / spam_decode.py
Created June 14, 2020 21:25
X-OVH-SPAMCAUSE decoder
def decode(msg):
text = []
for i in range(0, len(msg), 2):
text.append(unrot(msg[i: i + 2]))
return str.join('', text)
def unrot(pair, key=ord('x')):
offset = 0
for c in 'cdefgh':
@mrcomoraes
mrcomoraes / clear_cache_MS_Teams.sh
Last active May 10, 2024 12:07
Clear cache Microsoft Teams on Linux
#!/bin/bash
# This script cleans all cache for Microsoft Teams on Linux
# Tested on Ubuntu-like, Debian by @necrifede, Arch Linux by @lucas-dclrcq and Manjaro with flatpak by @danie1k. Feel free to test/use in other distributions.
# Tested Teams via snap package.
# Tested Teams via flatpak package.
#
# How to use in terminal:
# ./clear_cache_MS_Teams.sh ( deb-stable | deb-insider | snap | flatpak )
# or
@magnetikonline
magnetikonline / README.md
Last active December 4, 2024 01:22
Creating a 'run once' systemd unit.

Creating a 'run once' systemd unit

Systemd unit template which calls a script exactly once upon startup and keeps unit status active after script finishes.

Unit file placed in /etc/systemd/system and enabled with:

$ sudo systemctl enable runonce.service
$ sudo systemctl start runonce.service