Discover gists
// 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) |
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:
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
:
#!/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> |
# Write local | |
git config --local commit.gpgsign false | |
# Read local (if never set, can be an empty value) | |
git config --local commit.gpgsign |
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; |
#define エスティーディー std | |
#define アイオーストリーム <iostream> | |
#define ユージング using | |
#define イフ if | |
#define インクルード #include | |
#define イント int | |
#define シーアウト cout | |
#define シーイン cin | |
#define ネームスペース namespace | |
#define ブール bool |
This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.
Convert .mov/.MP4 to .gif
As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.
This is not limited to developer, anyone has this need can use this method to convert the files.