Skip to content

Instantly share code, notes, and snippets.

@hernan604
hernan604 / webdav-nginx.conf
Created March 12, 2024 01:27 — forked from akhilman/webdav-nginx.conf
Fixes for nginx's webdav to work with gvfs clients.
# Define lua functions
init_by_lua_block {
function is_dir(path)
local f = io.open(path, "r")
if not f then
return false
end
local ok, err, code = f:read(1)
f:close()
return code == 21
0-25 R : Time flies like an arrow. <- S ::= NP VP period
0- 4 R : Time <- NP ::= NN
# token
0- 4 T : Time <- NN
# glade 0- 4: Time ---
- (NP (NN Time))
5-24 R : flies like an arrow <- VP ::= VBZ PP
# token
5-10 T : flies <- VBZ
FROM: https://github.com/tendant/graphql-clj/blob/master/src/graphql.bnf
Document ::= <Ignored> Definition+ <Ignored>
Definition ::= TypeSystemDefinition | OperationDefinition | FragmentDefinition
OperationDefinition ::= <Ignored> OperationType? <Ignored> Name? <Ignored> VariableDefinitions? <Ignored> Directives? SelectionSet
Query ::= "query"
Mutation ::= "mutation"
OperationType ::= Query | Mutation
VariableDefinitions ::= <"("> VariableDefinition+ <")">
SourceCharacter ::= #"[\x{9}\x{A}\x{D}\x{20}-\uFFFF]"
@hernan604
hernan604 / fsnotify_example.go
Created November 4, 2021 21:18 — forked from hiroakis/fsnotify_example.go
fsnotify example: Detect file changes in real time.
package main
import (
"log"
"os"
"time"
"github.com/fsnotify/fsnotify"
)

Naive Bayes usando Perl e MongoDB

Introdução

Um classificador naive Bayes é provavelmente o exemplo mais tradicional para ilustrar "Inteligência Artificial" na prática. É bastante utilizado na eterna tarefa de discernir entre spam e não-spam (ham).

@hernan604
hernan604 / pubsub example vanilla javascript
Last active April 15, 2024 05:13
pubsub example vanilla javascript
/*
this is a pubsub pattern example.
the pubsub mechanism is in PubSub.
any class can use it by creating an instance ie:
// the class that accepts subscribers must implement PubSub:
//"MyClass" definitions:
//...
this.pubsub = new PubSub();
@hernan604
hernan604 / part_video_to_gif.sh
Created February 28, 2021 23:36 — forked from devadvance/part_video_to_gif.sh
Create animated GIF and WebP from videos using ffmpeg
ffmpeg -ss $INPUT_START_TIME -t $LENGTH -i $INPUT_FILENAME \
-vf "fps=$OUTPUT_FPS,scale=$OUTPUT_WIDTH:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
-loop $NUMBER_OF_LOOPS $OUTPUT_FILENAME
# Change these placeholders:
# * $INPUT_START_TIME - number of seconds in the input video to start from.
# * $LENGTH - number of seconds to convert from the input video.
# * $INPUT_FILENAME - path to the input video.
# * $OUTPUT_FPS - ouput frames per second. Start with `10`.
# * $OUTPUT_WIDTH - output width in pixels. Aspect ratio is maintained.
@hernan604
hernan604 / datachannel.pl
Created September 9, 2020 19:24 — forked from brianmed/datachannel.pl
WebRTC DataChannel two user chat. Signaling included using websockets.
#!/opt/perl
use Mojolicious::Lite;
use JSON;
get '/' => sub {
my $self = shift;
$self->render("index");
};
@hernan604
hernan604 / js-crypto-libraries.md
Created June 6, 2020 17:44 — forked from jo/js-crypto-libraries.md
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

I start with a list and plan to create a comparison table.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@hernan604
hernan604 / nginx
Created May 16, 2020 19:56 — forked from vdel26/nginx
Openresty init.d script
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx
# For Debian, run: update-rc.d -f nginx defaults
# For CentOS, run: chkconfig --add nginx
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all