Skip to content

Instantly share code, notes, and snippets.

View fititnt's full-sized avatar
💭
"The difficult we do immediately; the impossible takes a little longer"

Emerson Rocha fititnt

💭
"The difficult we do immediately; the impossible takes a little longer"
View GitHub Profile
localhost 341
nakarte.me 341
busti.me 341
masstimes.org 341
cruisingmap.net 341
footpathmap.co.uk 341
127.0.0.1 341
brouter.de 341
drivetest.ca 341
geotree.ru 341
@aaronNGi
aaronNGi / wordle.bash
Last active February 22, 2022 17:31
Wordle in 20 lines of bash
#!/usr/bin/env bash
mapfile -t words < <(grep -x '[a-z]\{5\}' "${WORDLIST:-/usr/share/dict/words}")
word=${words[RANDOM % ${#words[@]}]} pool=abcdefghijklmnopqrstuvwxyz
for ((round=1; round <= ${ROUNDS:=6}; round++)); do
while read -rp "$round/$ROUNDS: " guess || exit 1; do
[[ " ${words[@]} " == *" ${guess,,} "* ]] && guess=${guess,,} && break
done
for ((i=0, chars=0; i < ${#word}; i++)); do
[[ ${word:i:1} != ${guess:i:1} ]] && chars+=${word:i:1}
done
@rooks
rooks / csv.js
Last active March 12, 2024 12:25
CodeMirror rainbow CSV mode
const DELIM = ','
const QUOTE = '"'
const MAX_LENGTH = 9
const tokenRainbow = state => `string num${state.num}`
const tokenPlain = () => 'string'
CodeMirror.defineMode('csv', function modeCsv(opts, modeOpts) {
let { delimiter = DELIM, rainbow = false } = modeOpts
let token = rainbow ? tokenRainbow : tokenPlain
version: '3'
services:
traefik:
image: traefik:v2.0
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
@renatonerijr
renatonerijr / gist:78ea972e77b9d8c00b4b098072327f63
Last active April 13, 2019 03:52
Ideia para usar node.js com internet limitada

Ideia para usar node.js com internet limitada

Conversando com @fititnt me deu a ideia de como usar node com internet limitada, como muitos pacotes no npm possuem várias dependencias, baixando os pacotes e depois compactando o node_modules fica mais fácil para que pessoas com internet limitada consigam baixar.

@MohamedLamineAllal
MohamedLamineAllal / oneRouteForEachController.php
Last active December 17, 2018 13:23
How to serve images and files privatly in Laravel 5.7 (Medium)
<?php
public function getCompaniesLogo($file) {
// know you can have a mapping so you dont keep the sme names as in local (you can not precsise the same structor as the storage, you can do anything)
// any permission handling or anything else
$filePath = config('fs.gallery').DIRECTORY_SEPARATOR.$file; // here in place of just using 'gallery', i'm setting it in a config file
// here i'm getting only the path from the root (this way we can change the root later) / also we can change the structor on the store itself, change in one place config.fs.
// $filePath = Storage::url($filePath); <== this doesn't work don't use
// check for existance
if (!Storage::disk('local')->exists($file)){ // as mentionned precise relatively to storage disk root (this one work well not like Storage:url()
abort('404');
@mrbar42
mrbar42 / README.md
Last active May 22, 2024 19:06
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active March 12, 2024 22:46
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created

This is a short guide that explains how you can execute a federated query with Comunica.

Command line

We will execute a query to find all books in the Harvard Library that were written by people who were born in Ghent. We do this by federating over DBpedia (SPARQL), the Harvard library (TPF) and the VIAF dataset (TPF).

  1. Make sure Node.js (>=8.0.0) is installed: https://nodejs.org/en/
  2. Install Comunica: npm install -g @comunica/actor-init-sparql
  3. Execute the following command:
@Badel2
Badel2 / spectre.c
Last active March 12, 2023 00:18
Spectre attack example implementation
/* https://spectreattack.com/spectre.pdf */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif