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
#########
@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 / amazon_linux_install_varnish4.1.10.sh
Last active May 23, 2020 19:18 — forked from tankhuu/amazon_linux_install_varnish4.1.10.sh
Amazon Linux Install Varnish 4.1.10
# varnish 4.1
sudo yum -y install autoconf automake jemalloc-devel libedit-devel libtool ncurses-devel pcre-devel pkgconfig python-docutils python-sphinx graphviz
curl -s https://packagecloud.io/install/repositories/varnishcache/varnish41/script.rpm.sh | sudo bash
wget --content-disposition https://packagecloud.io/varnishcache/varnish41/packages/el/6/varnish-4.1.10-1.el6.x86_64.rpm/download.rpm
sudo rpm -Uvh varnish-4.1.10-1.el6.x86_64.rpm
/usr/sbin/varnishd -V
# varnish 4
sudo yum -y install autoconf automake jemalloc-devel libedit-devel libtool ncurses-devel pcre-devel pkgconfig python-docutils python-sphinx graphviz

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@teebu
teebu / Output Android Icons.jsx
Created March 2, 2019 22:31 — forked from Gamezpedia/Output Android Icons.jsx
Photoshop script to output Android icons (with XXXHDPI, XXHDPI, XHDPI, HDPI, MDPI support)
// Output Android Icons.jsx
// 2012 Todd Linkner
// License: none (public domain)
// v1.0 - base file by Todd Linkner
// v1.1 - added support for XXHDPI, XXXHDPI and added PNG to the file selector
//
// This script is for Photoshop CS6. It outputs Android icons of the
// following sizes from a source PSD at least 512px x 512px
//
// store:
@teebu
teebu / imagemagick.bash
Last active July 11, 2020 16:21 — forked from bensie/imagemagick.bash
ImageMagick Static Binaries for AWS Lambda ImageMagick-6.9.10-8 for AWS Lambda
#!/usr/bin/env bash
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime
# As of Nov 23, 2015, this is Amazon Linux AMI 2014.09.2 x86_64 (ami-0c682c64)
#
# Lambda includes ImageMagick 6.7.8-9 preinstalled, so you need to prepend PATH
# with the folder containing these binaries in your Lambda function to ensure
# these newer binaries are used.
#
# imagemagick binary will be in /var/task/imagemagick/bin/convert
@teebu
teebu / delay.js
Created July 6, 2018 05:40 — forked from daliborgogic/delay.js
Node.js Async/Await delay
'use strict'
const timeout = ms => new Promise(res => setTimeout(res, ms))
function convinceMe (convince) {
let unixTime = Math.round(+new Date() / 1000)
console.log(`Delay ${convince} at ${unixTime}`)
}
async function delay () {
@teebu
teebu / remove_pdf_password.sh
Created January 12, 2018 21:52 — forked from pstaender/remove_pdf_password.sh
Remove password from protected PDF file with GhostScript
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf