Skip to content

Instantly share code, notes, and snippets.

View willnaoosmith's full-sized avatar
🐧
Torvalds take the wheel 🙏🏻

William Brochensque Júnior willnaoosmith

🐧
Torvalds take the wheel 🙏🏻
View GitHub Profile
@willnaoosmith
willnaoosmith / CPF-CNPJ Formatter
Created September 28, 2020 19:19
CPF/CNPJ Formatter
UserParse(user){
const length = user.length
switch(true){
case length > 3 && length <= 6:
var ParsedUser = user.substring(0,3) + "." + user.substring(3, length)
break
@willnaoosmith
willnaoosmith / PushController.js
Created September 28, 2020 19:22
React-native firebase push controller
import React, { useEffect } from 'react'
import { Platform } from 'react-native'
import PushNotification from 'react-native-push-notification'
import AsyncStorage from '@react-native-community/async-storage'
import messaging from '@react-native-firebase/messaging'
const RemotePushController = () => {
useEffect(() => {
if(Platform.OS == "ios"){
@willnaoosmith
willnaoosmith / Unity converter
Created October 1, 2020 16:56
octets to kb/mb/gb/
def ConvertToUnity(data):
if data > 1073741824:
return str('{:.2f}'.format(data / 1073741824)) + " GB"
elif data > 1048576:
return str('{:.2f}'.format(data / 1048576)) + " MB"
else:
return str('{:.2f}'.format(data / 1024)) + " KB"
@willnaoosmith
willnaoosmith / SimpleCommandKeylogger.sh
Last active October 6, 2020 19:00
Logging all linux commands to file
#PROMPT_COMMAND+=$"history | tail -n 1 | cut -d ' ' -f 5- >> /logging/file/path/here.txt"
exec > >( ( printf ">>>>> TIME:$(date) SHELLPID:$$;\n"; tee /dev/tty ; printf ">>>>>\n" ) >> logfile.txt) 2>&1;
@willnaoosmith
willnaoosmith / CPF-CNPJ Validate
Created November 13, 2020 19:45
Validate if it's an valid CPF or CNPJ
def checkDoc(document):
try:
if re.match("[0-9]{3}\.[0-9]{3}\.[0-9]{3}\-[0-9]{2}", document) or re.match("[0-9]{2}\.[0-9]{3}\.[0-9]{3}\/[0-9]{4}\-[0-9]{2}", document):
return True
else:
return False
@willnaoosmith
willnaoosmith / Phone Number formatter
Created November 13, 2020 19:53
Format a phone number
filterPhone(number){
const length = number.length
switch(true){
case length >= 5 && length <= 8:
var ParsedNumber = number.substring(0,4) + "-" + number.substring(4, length)
break
@willnaoosmith
willnaoosmith / Meses
Created February 23, 2021 13:18
Meses do ano
Meses = [
{"Nome": "Janeiro", "Numero": 1},
{"Nome": "Fevereiro", "Numero": 2},
{"Nome": "Março", "Numero": 3},
{"Nome": "Abril", "Numero": 4},
{"Nome": "Maio", "Numero": 5},
{"Nome": "Junho", "Numero": 6},
{"Nome": "Julho", "Numero": 7},
{"Nome": "Agosto", "Numero": 8},
{"Nome": "Setembro", "Numero": 9},
@willnaoosmith
willnaoosmith / teamsGroupsDisable
Last active April 26, 2021 11:09
desativar criação de grupos teams
Install-Module AzureAD
Install-Module AzureADPreview
$GroupName = "groupname"
$AllowGroupCreation = $False
Connect-AzureAD
$settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id
if(!$settingsObjectID)
{
$template = Get-AzureADDirectorySettingTemplate | Where-object {$_.displayname -eq "group.unified"}
$settingsCopy = $template.CreateDirectorySetting()
@willnaoosmith
willnaoosmith / BusinessDaysCount
Last active November 1, 2021 17:46
Count of business days, including actual day, including saturdays.
select 6 * (DATEDIFF(@EndDate, @StartDate) DIV 7) + MID('1234566612345556123444561233345612223456111234560', 7 * WEEKDAY(@StartDate) + WEEKDAY(@EndDate) + 1, 1)
@willnaoosmith
willnaoosmith / DDD's.json
Last active February 18, 2022 12:28
Lista de DDD's por cidade, ordenados por DDD, depois por cidade
[{"CodigoIBGE": "3501152", "UF": "SP", "Cidade": "Alumínio", "DDD": "11"},
{"CodigoIBGE": "3502754", "UF": "SP", "Cidade": "Araçariguama", "DDD": "11"},
{"CodigoIBGE": "3503901", "UF": "SP", "Cidade": "Arujá", "DDD": "11"},
{"CodigoIBGE": "3504107", "UF": "SP", "Cidade": "Atibaia", "DDD": "11"},
{"CodigoIBGE": "3505708", "UF": "SP", "Cidade": "Barueri", "DDD": "11"},
{"CodigoIBGE": "3506607", "UF": "SP", "Cidade": "Biritiba-Mirim", "DDD": "11"},
{"CodigoIBGE": "3507100", "UF": "SP", "Cidade": "Bom Jesus Dos Perdões", "DDD": "11"},
{"CodigoIBGE": "3507605", "UF": "SP", "Cidade": "Bragança Paulista", "DDD": "11"},
{"CodigoIBGE": "3508405", "UF": "SP", "Cidade": "Cabreúva", "DDD": "11"},
{"CodigoIBGE": "3509007", "UF": "SP", "Cidade": "Caieiras", "DDD": "11"},