Skip to content

Instantly share code, notes, and snippets.

@fernandovaller
fernandovaller / js-mask-cpf-cnpj.js
Created December 5, 2018 20:53
Mascara para CPF e CNPJ em JS
function cnpj(v){
v=v.replace(/\D/g,"") //Remove tudo o que não é dígito
v=v.replace(/^(\d{2})(\d)/,"$1.$2") //Coloca ponto entre o segundo e o terceiro dígitos
v=v.replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3") //Coloca ponto entre o quinto e o sexto dígitos
v=v.replace(/\.(\d{3})(\d)/,".$1/$2") //Coloca uma barra entre o oitavo e o nono dígitos
v=v.replace(/(\d{4})(\d)/,"$1-$2") //Coloca um hífen depois do bloco de quatro dígitos
return v
}
function cpf(v){
hashtag_list = ['travelblog', 'travelblogger', 'traveler']
# prev_user_list = [] - if it's the first time you run it, use this line and comment the two below
prev_user_list = pd.read_csv('20181203-224633_users_followed_list.csv', delimiter=',').iloc[:,1:2] # useful to build a user log
prev_user_list = list(prev_user_list['0'])
new_followed = []
tag = -1
followed = 0
likes = 0
@Lerc
Lerc / index.html
Last active April 26, 2024 06:06 — forked from kahole/index.html
*scratch*.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>*scratch*</title>
<style>
body {
font-family: Hack, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
white-space: pre;
@surajp
surajp / dynaComp.html
Created August 15, 2023 17:27
Custom Elements in LWC
<template>
<h2>Dynamic Component</h2>
<div lwc:dom="manual" class="container"></div>
</template>
@kahole
kahole / index.html
Last active April 26, 2024 06:04
*scratch*.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>*scratch*</title>
<style>
body {
font-family: Hack, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
white-space: pre;
@ohownew
ohownew / 知识星球视频增强.js
Last active April 26, 2024 06:04
知识星球原生视频组件,无法通过键盘操作前进、后退、暂停、播放,于是写了一个简单的脚本,要先安装好篡改猴Tampermonkey等插件管理器。然后新建脚本,并复制如下代码
// ==UserScript==
// @name 知识星球视频增强
// @namespace http://tampermonkey.net/
// @version 2024-04-21
// @description 知识星球视频,通过键盘控制: 前进 后退 暂停 开始 全屏
// @author ohownew
// @match https://wx.zsxq.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=zsxq.com
// @grant none
// ==/UserScript==
<template>
<div class="slds-p-around_small">
<lightning-input label="Object Name" onchange={changeName}></lightning-input>
<lightning-input label="My Domain" onchange={changeDomain}></lightning-input>
<lightning-helptext content="Use document.cookie.match(/sid=([^;]*)/)[1] in the browser console after logging into SF" class="slds-p-right_xx-small"></lightning-helptext>
<lightning-input label="SessionId" onchange={changeSessionId}>
</lightning-input>
<lightning-textarea label="CSV Data"></lightning-textarea>
<lightning-button onclick={upload} label="upload"></lightning-button>
@manuelbl
manuelbl / README.md
Created August 3, 2019 09:12
ESP32 as Bluetooth Keyboard

ESP32 as Bluetooth Keyboard

With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed.

For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up.

In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone:

  1. Go to your computers/phones settings
  2. Ensure Bluetooth is turned on
# prompt: https://twitter.com/francoisfleuret/status/1783479122418716805
import os
os.environ['TORCH_LOGS'] = 'output_code' # shows all the bmms
import torch
torch.set_float32_matmul_precision('high')
N, T, D, U, C = 3, 128, 5, 32, 32 # batch, time, heads, head_dim, dim
S = T
A = torch.randn(N, T, D, U) / U**0.5
@madjo
madjo / converter.py
Created October 28, 2019 15:55
Convert {parquet | orc} to json and orc to parquet
#! /usr/bin/env python
import pandas as pd
import argparse
import os
import pyarrow.orc as orc
# usage: ./converter.py --help
CONVERTERS = ['parquet2json', 'orc2json', 'orc2parquet']