Skip to content

Instantly share code, notes, and snippets.

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 25, 2024 15:17
Hyperlinks in Terminal Emulators
@giordanocardillo
giordanocardillo / README.md
Last active April 25, 2024 15:16
Setting nano as default editor

How to

Automatically

cat <<EOF >>~/.bash_profile
export VISUAL="nano"
export EDITOR="nano"
EOF
@csalmeida
csalmeida / README.md
Last active April 25, 2024 15:16
Using MutationObserver to listen to attribute changes

Mutation Observer Example

This is a working example of using the MutationObserver API to listen to changes in an DOM element's attributes.

Clicking the button triggers a change and in turn MutationObserver will notice the change. Logs available in the console.

Resources

@mbbx6spp
mbbx6spp / ALTERNATIVES.adoc
Last active April 25, 2024 15:14
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
@ivonielson
ivonielson / validacao+mascara.js
Created April 25, 2024 15:13 — forked from ricardodantas/validacao+mascara.js
Máscara e validação de RG, CNPJ, CPF, etc...
// JavaScript Document
// adiciona mascara para rg
// Cada estado têm regras e quantidades diferentes de números no registro. Por isso,
// não há uma maneira confiável de fazer a validação do mesmo.
function MascaraRg(v0,errChar='?'){
const v = v0.toUpperCase().replace(/[^\dX]/g,'');
return (v.length==8 || v.length==9)?
v.replace(/^(\d{1,2})(\d{3})(\d{3})([\dX])$/,'$1.$2.$3-$4'):
(errChar+v0)

Keybase proof

I hereby claim:

  • I am zippi-md on github.
  • I am zippi_md (https://keybase.io/zippi_md) on keybase.
  • I have a public key ASDwZ6QePrwoziOhFNLKuDok-B4kFgY7hpFciys6axd9IAo

To claim this, I am signing this object:

@v-fox
v-fox / NVMe_tweaks.md
Last active April 25, 2024 15:09
Linux kernel optimizations for NVMe

By default Linux distros are unoptimized in terms of I/O latency. So, here are some tips to improve that.

The performance can be checked by:

  • fio --name=read --readonly --rw={read/randread} --ioengine=libaio --iodepth={jobs_per_each_worker's_command} --bs={4k/2M} --direct={0/1} --numjobs=<number_of_parallel_workers> --runtime={10/30/60} --group_reporting --filename=/dev/nvme<device> - to simulate an optimized app;
  • dd_rescue /dev/nvme<device> /dev/null -b {4k/2M} {-d} - to simulate a stupid app.

Appropriate settings are changed in appropriate places, such as:

  • /etc/tuned/<custom-profile>/tuned.conf:
@BigNerd
BigNerd / download-my-fritz-box-logs.sh
Created June 2, 2019 10:48
This bash script downloads the current Fritz Box event log as JSON file and as TXT file
#!/bin/bash
#
# This bash script downloads the current Fritz Box event log as JSON file and as TXT file.
#
# The login procedure was implemented according to https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/AVM_Technical_Note_-_Session_ID.pdf
#
# The script was tested successfully on MacOS High Sierra 10.13.6 with Fritz!Box 6490 Cable (kdg)
PASSWORD=<replace-with-your-fritz-box-password>
@webarchitect609
webarchitect609 / terminal.sh
Last active April 25, 2024 15:07
Git: disable GPG signing for current repo only.
# Write local
git config --local commit.gpgsign false
# Read local (if never set, can be an empty value)
git config --local commit.gpgsign
@Flafla2
Flafla2 / Perlin.cs
Last active April 25, 2024 15:04
Improved Perlin Noise Implementation in C#
public class Perlin {
public static double OctavePerlin(double x, double y, double z, int octaves, double persistence) {
double total = 0;
double frequency = 1;
double amplitude = 1;
for(int i=0;i<octaves;i++) {
total += perlin(x * frequency, y * frequency, z * frequency) * amplitude;
amplitude *= persistence;