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
@magnetikonline
magnetikonline / README.md
Last active January 17, 2024 09:29
Creating a 'run once' systemd unit.

Creating a 'run once' systemd unit

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

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

$ sudo systemctl enable runonce.service
$ sudo systemctl start runonce.service
@mrcomoraes
mrcomoraes / clear_cache_MS_Teams.sh
Last active February 16, 2024 22:55
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
@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':
@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

@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.
@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

@florina-muntenescu
florina-muntenescu / BaseDao.kt
Last active September 28, 2023 15:01
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
@NikolaDespotoski
NikolaDespotoski / RichBottomNavigationView.java
Last active February 13, 2023 23:51
Saving and restoring BottomNavigationView state
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.design.widget.BottomNavigationView;
@Anubisss
Anubisss / README.md
Last active March 13, 2024 10:04
How to compile statically linked OpenVPN client for ARMv5

How to compile statically linked OpenVPN client for ARMv5

You need to install ARMv5 gcc cross compiler: apt-get install gcc-arm-linux-gnueabi

You have to define a directory (via --prefix) where all of your binaries will be installed (copied). In the guide I use the following: /home/user/vpn_compile

OpenSSL

  1. Download the source: wget https://www.openssl.org/source/openssl-1.0.2j.tar.gz
@borichellow
borichellow / BottomNavigationViewExtended.java
Last active July 2, 2017 14:46
extension for BottomNavigationView from Design Support Library
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomNavigationView;
import android.util.AttributeSet;
import android.view.MenuItem;
import javax.annotation.Nonnull;