Skip to content

Instantly share code, notes, and snippets.

# Create this file in /etc/udev/rules.d/51-android.rules (root owned, bitmask 0644)
# Reload udev (udevadm control --reload-rules)
#
# It will allow members of the `adbusers` group to access the phone over usb without being root
# You should create a new unprivileged user who is a member of this group, then run `adb` as said user
#
# To add a new device, plug in the device and run `lsusb` to determine its device id then add it in, eg:
# $ lsusb
# Bus 002 Device 063: ID 18d1:4ee7 Google Inc. Nexus/Pixel Device (charging + debug)
@kennypete
kennypete / navigating_the_modes_of_Vim.md
Created April 18, 2024 20:46
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc.

@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
@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
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active May 10, 2024 12:07
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@wteuber
wteuber / encrypt_decrypt.rb
Last active May 10, 2024 12:04
Simply encrypt and decrypt Strings in Ruby.
require 'openssl'
class String
def encrypt(key)
cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
cipher.key = Digest::SHA1.hexdigest key
s = cipher.update(self) + cipher.final
s.unpack('H*')[0].upcase
end
@cmtickle
cmtickle / patching_magento2_app_code.md
Last active May 10, 2024 12:04
Patching Magento 2 Code

To patch code in Composer modules

  1. composer require cweagans/composer-patches
  2. Create your patch file as normal (referencing the paths to file in /vendor) and put it in a '.patches' folder at the top level of your code base.
  3. Edit composer.json to apply the patch(es) as below (this goes at the first level of composer.json) :
    "extra": {
        "magento-force": "override",
        "enable-patching": true,
        "patches-file": "composer.patches.json"
 },
@UtpalMaiti
UtpalMaiti / algo expert Systems Design Quiz With answers(Ans.).txt
Last active May 10, 2024 12:03
algo expert Systems Design Quiz With answers(Ans.).txt
The following is often used as an index for spatial data that needs to be queried
with low latency:
A SQL database.
A geofence.
Ans. quadtree.
A shard.
When designing an API endpoint to list some arbitrary entities, like comments on a
video or posts on a news feed, you typically want the endpoint to support:
Deletion.