Skip to content

Instantly share code, notes, and snippets.

@okurz
okurz / test_ssh.pl
Created February 25, 2019 21:27
test_ssh.pl
use strict;
use warnings;
use Net::SSH2;
my %args = (hostname => 'myhost', password => 'XXX', username => 'root');
my $ssh = Net::SSH2->new;
sub get_ssh_output {
my ($chan) = @_;
@facontidavide
facontidavide / unordered_with_string_view.cpp
Last active June 6, 2023 22:22
Use std::string_view to find() an element in std::unordered_map<string,T>, avoiding potential memory allocations
#include <iostream>
#include <cstring>
#include <unordered_map>
// https://github.com/martinmoene/string-view-lite
#include "string_view.hpp"
template <typename Value>
class StringMap: public std::unordered_map<std::string, Value>
{
public:

Building a mingw-w64 GCC cross-compiler with nixcrpkgs: instructions for Terry, October 2018

  1. Install Nix, the functional package manager. You'll need Linux (but macOS might work too).
  2. Make sure you have at least 4 GB of free space available for /tmp and a few GB of free space available for /nix.
  3. To get my recipes, run: git clone https://github.com/DavidEGrayson/nixcrpkgs && cd nixcrpkgs && git checkout 4f7b11d That commit is the current tip of the dev/david/2019 branch.
  4. To build a i686-w64-mingw32 C/C++ cross-compiling toolchain and a hello world program, run: nix-build -A win32.hello
  5. To build Qt and its examples, run: nix-build -A win32.qt.examples
  6. To just build the toolchain itself, run: nix-build -A win32.gcc
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active August 20, 2025 14:16
set -e, -u, -o, -x pipefail explanation
@nico-lab
nico-lab / hevc_nvenc.txt
Last active June 11, 2025 11:50
ffmpeg -h encoder=hevc_nvenc
Encoder hevc_nvenc [NVIDIA NVENC hevc encoder]:
General capabilities: dr1 delay hardware
Threading capabilities: none
Supported hardware devices: cuda cuda d3d11va d3d11va
Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 bgra rgb0 rgba x2rgb10le x2bgr10le gbrp gbrp16le cuda d3d11
hevc_nvenc AVOptions:
-preset <int> E..V....... Set the encoding preset (from 0 to 18) (default p4)
default 0 E..V.......
slow 1 E..V....... hq 2 passes
medium 2 E..V....... hq 1 pass
@Killeroid
Killeroid / gpg-import-and-export-instructions.md
Created October 18, 2017 11:51
How to export and import gpg keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Gotten from the RedHat GPG migration manual

Backup the public and secret keyrings and trust database

## Export all public keys

gpg -a --export >mypubkeys.asc

@rakkesh
rakkesh / tageditor.rb
Last active June 20, 2018 21:10
[WIP] Homebrew formula for tageditor
class Tageditor < Formula
desc "Tag editor supporting MP4/M4A/AAC (iTunes), ID3, Vorbis, Opus, FLAC and Matroska"
homepage "https://github.com/Martchus/tageditor"
url "https://github.com/Martchus/tageditor/archive/v2.2.4.tar.gz"
sha256 "b6086c56fde764abebcd39bf050fae60d335f0317336dc0e18ac2c944df4a7a7"
depends_on "cmake" => :build
depends_on "cppunit" => :build
depends_on "openssl"
DROP DATABASE IF EXISTS 📚;
CREATE DATABASE 📚;
USE 📚;
CREATE TABLE 👤(
🔑 INTEGER PRIMARY KEY,
🗣 varchar(64), -- name
🗓 DATE -- date of registration
@cryzed
cryzed / fix-infinality.md
Last active July 21, 2025 16:10
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08: