Skip to content

Instantly share code, notes, and snippets.

View eberfreitas's full-sized avatar

Éber Freitas Dias eberfreitas

View GitHub Profile
@eberfreitas
eberfreitas / Backend.elm
Last active April 3, 2023 23:27
Example of backend code built with Elm
port module Backend exposing (main)
import Express exposing (Conn)
import Express.Cookie as Cookie
import Express.Http as Http exposing (Method(..))
import Express.Request as Request
import Express.Response as Response
import Json.Decode as D
import Json.Encode as E
import Url.Parser as Parser exposing ((</>))
@eberfreitas
eberfreitas / fuckoff.js
Created March 5, 2021 18:26
Fuck Off Twitter!
// ==UserScript==
// @name Fuck off Twitter! - twitter.com
// @namespace Violentmonkey Scripts
// @match https://twitter.com/home
// @grant none
// @version 1.0
// @author Eduardo Cuducos - https://github.com/cuducos/fuckoff-twitter/blob/ec14293dda1467be71abb2549d2a36972e9e148f/twitter.js
// @description Changes from regular Twitter's homepage to latest tweets
// ==/UserScript==
# ALIASES
alias setup='cd ~/ && clear && tmux'
# asdf installs everything locally, so running sudo directly doesn't work
# this command uses the local path variable so you can access everything
# from the root user
alias mysudo='sudo -E env "PATH=$PATH"'
# git aliases
syntax on
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'andys8/vim-elm-syntax'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'NLKNguyen/papercolor-theme'
@eberfreitas
eberfreitas / settings.json
Last active December 27, 2020 20:57
My Windows Terminal config
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{3c820ee3-81cb-4a00-b462-d7e9c3533128}",
"alwaysShowTabs": false,
"profiles":
[
@eberfreitas
eberfreitas / tmux.conf
Last active July 28, 2021 12:52
My tmux config
# Changes prefix to Ctrl+a
set -g prefix C-a
unbind-key C-b
# Starts windows numbers at 1
set -g base-index 1
setw -g pane-base-index 1
# Renumber windows when closing one
set-option -g renumber-windows on
@eberfreitas
eberfreitas / Caddyfile
Created March 11, 2016 06:33
Caddy configuration for CakePHP 3 (and probably 2 as well) - Use this file on your project root
localhost:80
root webroot
fastcgi / 127.0.0.1:9000 php
rewrite {
to {path} {path}/ /index.php?{path}&{query}
}
@eberfreitas
eberfreitas / safe_image_upload.php
Last active February 16, 2016 05:02
A simple function to performe safe image upload using PHP, with proper mime check and image strip
<?php
function save_image_upload($file, $path, $id = null) {
$mime2ext = [
'image/jpeg' => 'jpg',
'image/jpg' => 'jpg',
'image/png' => 'png'
];
$ext2functions = [
@eberfreitas
eberfreitas / vbox
Created November 13, 2015 13:47
Easier VBoxManage
#!/bin/bash
VBOXPATH="/cygdrive/c/Program Files/Oracle/VirtualBox/VBoxManage.exe"
case "$1" in
"start" | "startvm")
echo "Starting VM \"$2\"..."
cmd="\"$VBOXPATH\" startvm $2 --type headless"
eval $cmd
;;
@eberfreitas
eberfreitas / CronShell.php
Created May 24, 2015 19:14
Cronjobs for Shell scripts in CakePHP
<?php
use \Cron\CronExpression;
App::uses('AppShell', 'Console/Command');
class CronShell extends AppShell {
protected $_tasks = [];