Skip to content

Instantly share code, notes, and snippets.

View loretoparisi's full-sized avatar
🐍
NightShift

Loreto Parisi loretoparisi

🐍
NightShift
View GitHub Profile
@loretoparisi
loretoparisi / ukraine.css
Created March 2, 2022 17:15
SVG Lighting Effects With The feDiffuseLighting Filter Primitive
/* Add the seed attribute and set it to a random integer in <feTurbulence> to create your own variant! */
html,
body,
object {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
}
div {
@loretoparisi
loretoparisi / resumablejs.html
Created January 31, 2022 14:22
ResumableJS File upload Example
<html>
<header>
<style>
.drop-zone {
text-align: center;
border: 2px dashed #ccc;
}
.danger,
.danger:hover {
@loretoparisi
loretoparisi / resumable.js
Last active January 31, 2022 16:21
Resumable.JS - NodeJS Express example - fixed deprecations, updated to latest express
var fs = require("fs"),
path = require("path"),
util = require("util"),
Stream = require("stream").Stream;
module.exports = resumable = function (temporaryFolder) {
var $ = this;
$.temporaryFolder = temporaryFolder;
$.maxFileSize = null;
$.fileParameterName = "file";
@loretoparisi
loretoparisi / targz.js
Created November 20, 2021 01:09
NodeJS Unarchive tar gz file
const { Duplex } = require('stream'); // Native Node Module
function bufferToStream(myBuffer) {
let tmp = new Duplex();
tmp.push(myBuffer);
tmp.push(null);
return tmp;
}
async function tarStream() {
const zlib = require('zlib');
@loretoparisi
loretoparisi / index.html
Created November 19, 2021 22:53 — forked from Lakerfield/index.html
Print ZPL from browser
<!DOCTYPE html>
<html>
<head>
<title>Print Inventory Labels at Papa's</title>
<style>
* {
box-sizing: border-box;
}
@loretoparisi
loretoparisi / List_of_Wikipedias.json
Created October 13, 2021 16:19
List of Wikipedias as JSON
[{
"language": "English",
"language_local": "English",
"wiki": "en",
"articles": "6,393,265",
"totals": "1,044,989,942",
"edits": "1,077",
"admins": "42,366,457",
"users": "125,915",
"active_users": "895,061"
@loretoparisi
loretoparisi / es_autocomplete.mapping.js
Created September 20, 2021 17:16
Elastic Search Auto Complete Analyzer
{
"aliases": {},
"mappings": {
"properties": {
"text": {
"type": "text",
"analyzer": "autocomplete"
}
}
},

With wildcard

{
  "query": {
    "bool": {
      "must": [
        {
          "wildcard": {
 "text": "*antonio*banderas*"
@loretoparisi
loretoparisi / awscat.sh
Last active August 20, 2021 09:45
AWS S3 CAT to BASH
#!/bin/bash
function __awscat {
if [ "$1x" != 'x' ]; then
aws s3 cp --quiet "$1" /dev/stdout
fi
}
__awscat $1
@loretoparisi
loretoparisi / thread_support.py
Created August 5, 2021 16:56
Python Thread Support with Bounder Thread Pool or Process Executor
from functools import wraps
from .bounded_pool_executor import BoundedThreadPoolExecutor
from .bounded_pool_executor import BoundedProcessPoolExecutor
_DEFAULT_POOL = BoundedThreadPoolExecutor(max_workers=5)
_PROCESS_POOL = BoundedProcessPoolExecutor(max_workers=5)
def threadpool(f, executor=None):
@wraps(f)
def wrap(*args, **kwargs):