Skip to content

Instantly share code, notes, and snippets.

@MateusRodCosta
MateusRodCosta / Improved Microphone (Male voices, with Noise Reduction).json
Last active May 1, 2024 05:21
An EasyEffects preset created for input devices (intended for Microphones). Please read the README.md.
{
"input": {
"blocklist": [],
"compressor": {
"attack": 20.0,
"boost-amount": 6.0,
"boost-threshold": -72.0,
"hpf-frequency": 10.0,
"hpf-mode": "off",
"input-gain": 0.0,
@imantung
imantung / ast_print_struct_fields.go
Created June 3, 2020 11:07
Print struct field using golang AST
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
)
var src = `package mypackage
#!/usr/bin/env sh
set -- $(locale LC_MESSAGES)
yesptrn="$1"; noptrn="$2"; yesword="$3"; noword="$4"
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
input_sink=$(pacmd stat |grep -o -P "(?<=Default source name: ).*")
output_sink=$(pacmd stat |grep -o -P "(?<=Default sink name: ).*")
echo "Input:" $input_sink
@treeform
treeform / radix.nim
Created February 21, 2020 01:00
Radix sort in Nim.
## Radix sort in O(n) unlike other sorting methods that can be way worse.
## But radix sort needs the bits to operate on, which makes it different then
## other sorting algorithms.
proc getMax(arr: seq[SomeInteger]): SomeInteger =
for i, e in arr:
if i == 0:
result = e
elif e > result:
result = e
@esters
esters / openwrt-user-installed-packages.sh
Created August 7, 2019 12:00
OpenWRT - List user installed packages
#!/bin/sh
for o in `opkg list-installed | awk '{ print $1}'`
do
opkg status $o | grep "user installed" -B 3 | awk '/Package:/{print $2}'
done
@traversc
traversc / fdtest.cpp
Created July 24, 2019 21:02
Using file descriptors directly in R
#include <cerrno>
#include <fcntl.h>
#include <cstdio>
#include <unistd.h>
#include <string.h>
#include <array>
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::plugins(cpp11)]]
@ax3l
ax3l / CXXdefaults.md
Last active April 8, 2024 18:19
Compiler C++ Version Defaults

C++ -std=... default of various commonly used C++ compilers

Compiler Version __cplusplus
g++ 4.7.4 199711L
5.5.0 199711L
6.1.0 201402L
10.2 201402L
11.1.0 201703L
clang++ 3.4.2 199711L
@ioggstream
ioggstream / system-sleep-xhci.sh
Created November 7, 2017 13:08
Disable broken xhci device before suspend and avoid freeze.
#!/bin/sh
#
# This script should prevent the following suspend errors
# which freezes the Dell Inspiron laptop.
#
# Put it in /usr/lib/systemd/system-sleep/xhci.sh
#
# The PCI 00:14.0 device is the usb xhci controller.
#
# kernel: [67445.560610] pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16
--- a/src/cpp/core/system/Crypto.cpp.orig 2017-10-14 15:59:52.561983799 +0900
+++ b/src/cpp/core/system/Crypto.cpp 2017-10-14 15:58:24.504542511 +0900
@@ -261,27 +261,26 @@ Error aesEncrypt(const std::vector<unsig
int outlen = 0;
int bytesEncrypted = 0;
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
- EVP_CipherInit_ex(&ctx, EVP_aes_128_cbc(), NULL, &key[0], &iv[0], kEncrypt);
+ EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
@antoineMoPa
antoineMoPa / get_multipart_file.cpp
Last active June 18, 2023 17:40
C++ to decode HTTP multipart form data from stdin to a file named data.tmp (no dependencies)
/**
* Copyright 2022 Antoine Morin-Paulhus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH