Skip to content

Instantly share code, notes, and snippets.

from random import randint
def generate_fr_vat():
siren = randint(100000000, 999999999)
key = (12 + 3 * (siren % 97)) % 97
return 'FR' + str(key) + str(siren)
print(generate_fr_vat())
@teebu
teebu / validateABN.js
Created March 30, 2023 15:47 — forked from airtonix/validateABN.js
Validate Australian Business Number
/**
* Checks ABN for validity using the published ABN checksum algorithm.
* @author Guy Carpenter
* @license http://www.clearwater.com.au/code None
* @param {String|Number} value abn to validate
* @return {Boolean} Is ABN Valid
*/
function validateABN (value) {
var weights = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19],
##########################################
# Helmfile #
# How to manage Kubernetes Helm releases #
# https://youtu.be/qIJt8Iq8Zb0 #
##########################################
# Referenced videos:
# - K3d - How to run Kubernetes cluster locally using Rancher k3s: https://youtu.be/mCesuGk-Fks
#########
storefront = {
'AL':'143575',
'DZ':'143563',
'AO':'143564',
'AI':'143538',
'AG':'143540',
'AR':'143505',
'AM':'143524',
'AU':'143460',
'AT':'143445',
@teebu
teebu / Webstorm-Airbnb-Javascript-codeStyle.xml
Created April 2, 2021 02:22 — forked from mentos1386/Webstorm-Airbnb-Javascript-codeStyle.xml
Airbnb inspired Webstorm Javascript CodeStyle
<code_scheme name="Airbnb">
<option name="RIGHT_MARGIN" value="100" />
<option name="HTML_ATTRIBUTE_WRAP" value="4" />
<option name="HTML_ELEMENTS_TO_INSERT_NEW_LINE_BEFORE" value="" />
<option name="HTML_ENFORCE_QUOTES" value="true" />
<DBN-PSQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
@teebu
teebu / app.py
Created November 13, 2020 02:08
import numpy as np
import matplotlib.pyplot as plt
from math import exp, log
def getGaussDecayValue(value,origin,scale,decay,offset=0):
# does this work?
z = -1*(scale**2)/(2*log(decay))
a = (-1* (max(0, abs(value - origin) - offset)**2))
@teebu
teebu / app.py
Created November 6, 2020 00:42
normalizing score
import numpy as np
import matplotlib.pyplot as plt
from math import exp, log
def getGaussDecayValue(value,origin,scale,decay,offset=0):
# does this work?
z = -1*(scale**2)/(2*log(decay))
a = (-1* (max(0, abs(value - origin) - offset)**2))
@teebu
teebu / sample_dynamic_mapping
Created August 12, 2020 21:49
sample dynamic mapping
PUT mapping_test
{
"settings": {
"index": {
"number_of_shards": "1",
"refresh_interval": "1s"
}
},
"mappings": {
"numeric_detection": false, // treat numbers in strings as numbers

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track