Skip to content

Instantly share code, notes, and snippets.

View rafa-acioly's full-sized avatar
💭
-f

Rafael Acioly rafa-acioly

💭
-f
  • São Paulo - Brazil
View GitHub Profile
@evertrol
evertrol / gist:47325e62f8caae1b72ee
Last active February 16, 2021 13:16
Asyncio: cancel a set of coroutines from another coroutine, by stopping the event loop
"""Example to cancel a set of asyncio coroutines (futures),
using one coroutine to signal the event loop to stop.
"""
import asyncio
import logging
from datetime import datetime
from concurrent.futures import CancelledError
@cpereiraweb
cpereiraweb / crm.conf
Created September 20, 2016 22:16
Laravel rodando em alias (url subdir) no Apache 2.4
#1) crie os alias para o subdir
Alias /crm/ /srv/www/portais/crm/public/
Alias /crm /srv/www/portais/crm/public/
#2) defina as permissões do diretório físico
<Directory "/srv/www/portais/crm/public/">
AllowOverride All
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
Require all granted
</Directory>
/*
Cell compete:
Eight houses, represented as a cells, are arranged as a straight line.
Each days every cells competes with adjacent cells. An integer value 1
represents an active cell and a value of 0 represent an inactive cell.
if the neigbour on both the sides of the cell are both active or inactive,
the cell become inactive in the next day, otherwise the become active.
The two cells on each or have a single adjacent cell, so asume that
the onoccupied space in the opposite side is an inactive cell. even after
updating the cell state, consider its previus state when updating the state
noremap ,g :!go run ./%<cr>
noremap ,t :!make test<cr>
setlocal omnifunc=v:lua.vim.lsp.omnifunc
compiler go
nnoremap <buffer> <space> :silent make <bar> redraw!<CR>
" noremap ,G :w!\|!go run --gcflags "-m=2" ./%<cr>
" noremap <localleader>g :w!\|!go run ./%<cr>
" noremap ,g :w!\|!go build; ./main<cr>
@trvswgnr
trvswgnr / compress_video
Last active November 12, 2024 21:17
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in