Skip to content

Instantly share code, notes, and snippets.

View edbizarro's full-sized avatar
🎲
Crunching data

Eduardo Bizarro edbizarro

🎲
Crunching data
View GitHub Profile
@themsaid
themsaid / scripts.bash
Last active December 1, 2020 19:09
My .zshrc
alias art="php artisan"
alias dracarys="git reset --hard && git clean -df"
alias phpfix="php php-cs-fixer.phar fix"
alias weather='curl -s wttr.in/Hurghada | sed -n "2,7p"'
alias usd='curl -s "https://www.google.com/finance/converter?a=1&from=USD&to=EGP" | LC_CTYPE=C sed "/res/!d;s/<[^>]*>//g"'
alias shrug="echo '¯\_(ツ)_/¯' | pbcopy";
alias fight="echo '(ง'̀-'́)ง' | pbcopy";
alias happy="echo 'ᕕ( ᐛ )ᕗ' | pbcopy";
# Commit all the current changes with a message
@rodurma
rodurma / filters.php
Created October 27, 2016 19:57
Filtros estilo GMail
<?php
$input = 'nome:ps4 sku:SKU7889-988;OI99129 data:10/12/2016 nome:Playstation 4 nome:Nintendo Wii sku:TESTE123 9aos';
preg_match_all('/(?:([^: ]+):)([^: ]+(?:\s+[^: ]+\b(?!:))*)/', $input, $matches, PREG_SET_ORDER);
echo $input;
echo '<pre>';
print_r($matches);
echo '</pre>';
@isuzuki
isuzuki / .php_cs
Last active June 7, 2025 09:54
Config for PHP-CS-Fixer ver 2 (based on laravel .php_cs https://github.com/laravel/framework/blob/5.4/.php_cs)
<?php
/**
* Config for PHP-CS-Fixer ver2
*/
$rules = [
'@PSR2' => true,
// addtional rules
@sebastiencs
sebastiencs / volume.sh
Last active February 16, 2025 13:42
Script to get volume notification with dunst http://imgur.com/a/qWgAw
#!/bin/bash
# You can call this script like this:
# $./volume.sh up
# $./volume.sh down
# $./volume.sh mute
function get_volume {
amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1
}
@NiFNi
NiFNi / check_nano_node.sh
Last active March 17, 2018 12:40
Check if a local nano node with RPC enabled is reachable. If not send an email.
# Before usage make sure to have a working mail setup.
# If you are not sure what that means and you run Ubuntu just run "apt install mailutils" and
# choose following settings (be sure to replace example.com with your domain):
# General type of mail configuration?: Internet Site
# System mail name: example.com
# Root and postmaster mail recipient: username
# Other destinations to accept mail for: $myhostname, example.com, mail.example.com, localhost.example.com, localhost
# Force synchronous updates on mail queue?: No
# Local networks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
@bearloga
bearloga / druid-csv-spec_country-all.json
Last active June 25, 2019 05:48
Druid ingestion spec for gzipped CSV data
{
"type": "index_hadoop",
"spec": {
"ioConfig": {
"type": "hadoop",
"inputSpec": {
"paths": "hdfs://analytics-hadoop/tmp/gsc-all.csv.gz",
"type": "static"
}
},
<?php
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' =>
[
'align_equals' => true,
@Billz95
Billz95 / .php_cs.dist
Last active September 28, 2025 19:30
A Customised fixer for PHP-CS-Fixer to use `prettier`'s php plugin to pre-process the code before getting analysed by other fixers. This would enable `php-cs-fixer` to take advantage of `prettier`'s ability of managing long line.
<?php
require_once __DIR__.'/relative/path/to/PrettierPHPFixer/File';
return PhpCsFixer\Config::create()
->registerCustomFixers([
(new PrettierPHPFixer()),
])
->setRules([
'Prettier/php' => true,
WITH RECURSIVE traversed (id, name, path, `left`, `right`) AS (
SELECT id,
name,
CAST(JSON_ARRAY(id) AS JSON),
`left`,
`right`
FROM binary_tree
WHERE id = 1
UNION
SELECT b.id,
@drewbanin
drewbanin / example_model.sql
Created July 24, 2019 23:14
Rollup materialization on Snowflake
-- models/example_model.sql
{{ config(
materialized='rollup',
rollups={
"hourly": "date_trunc('hour', event_time)",
"daily": "date_trunc('day', event_time)"
},
aggregates={