Skip to content

Instantly share code, notes, and snippets.

@Balastrong
Balastrong / .gitconfig
Last active November 9, 2024 14:10
Some handy git aliases
# These aliases have been collected and shown in the making of this video, explaining how to set up and use git alises
# Source: https://youtu.be/Uk4GnYoQx_I
[alias]
# Shortcuts
ch = checkout
br = branch
st = status
br = branch
cm = commit -m
@sts10
sts10 / rust-command-line-utilities.markdown
Last active April 30, 2025 14:31
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
@heiny
heiny / EncryptDecryptRDCMan.ps1
Last active February 18, 2025 06:52
Powershell: Encrypt/Decrypt Remote Desktop Connection Manager Credentials
# There is no facility to replace passwords in RDCMan once they are stored. The only way is to create a new custom credential.
# If you open your *.rdg file in a text editor, locate the stored <password>, you can then decrypt it using this script.
# This script can also encrypt a plain text password in rdg format which can be used to overwrite an existing one in the xml.
Add-Type -AssemblyName System.Security;
Function EncryptPassword {
[CmdletBinding()]
param([String]$PlainText = $null)
# convert to RDCMan format: (null terminated chars)
@ThomasLeister
ThomasLeister / lxd-grow-zfs-pool-file.txt
Created March 6, 2018 07:44
Grow LXD ZFS pool file (LXD snap package)
According to: "Growing a loop backed ZFS pool" on https://lxd.readthedocs.io/en/latest/storage/
For LXD via Snap package:
- The default pool is located at /var/snap/lxd/common/lxd/disks/default.img
- and is named "default".
### To increase the pool size by 20 GiB do this:
>>> Stop all your containers! <<<
@bookiu
bookiu / php7_install.sh
Last active February 13, 2023 05:53
Ubuntu下PHP7编译安装参数以及系统依赖库安装
wget http://cn2.php.net/distributions/php-7.2.4.tar.gz
tar zxvf php-7.2.4.tar.gz
cd php-7.2.4
# Base directory
PHP_INSTALL_DIR='/usr/local/php72'
PHP_CONFIG_DIR="$PHP_INSTALL_DIR/etc"
PHP_CONFIG_SCAN_DIR="$PHP_CONFIG_DIR/php.d"
# Dependency
@mamchenkov
mamchenkov / monolog.php
Last active January 5, 2022 09:31
Example use of Monolog logger
<?php
// Before: composer require monolog/monolog
// composer autoloader
require_once 'vendor/autoload.php';
// Shortcuts for simpler usage
use \Monolog\Logger;
use \Monolog\Formatter\LineFormatter;
use \Monolog\Handler\StreamHandler;
@flbuddymooreiv
flbuddymooreiv / passgitgpg.md
Last active March 6, 2025 07:50
Setting up pass on git with a gpg key

The following shell transcript shows how to:

  • Create a GPG key
  • Create a pass database
  • Add git support to the pass database
  • Create a remote git repository
  • Push the pass database to the remote git repository
  • Fetch and display your passwords from another host

It is assumed that the pass package has been installed on both the first and second computers.

@danburzo
danburzo / README.md
Last active July 29, 2021 08:41
Get all event listeners on the page in Google Chrome
@nikic
nikic / objects_arrays.md
Last active April 24, 2025 06:50
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@menzerath
menzerath / backup.php
Last active February 18, 2024 19:33
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* MIT-License - 2012-2018 Marvin Menzerath
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit', '1024M');