Skip to content

Instantly share code, notes, and snippets.

View InFog's full-sized avatar
🤔
Thinking

Evaldo Bento InFog

🤔
Thinking
View GitHub Profile
@InFog
InFog / comfyline.sh
Created August 14, 2023 18:57
My colors for comfyline
RETVAL_b="#005f87" # background
RETVAL_f="#eceeed" # foreground
HOST_b="#5f87af"
HOST_f="#eceeed"
USER_b="#005f87"
USER_f="#eceeed"
GIT_b="#f6b3b3"
GIT_f="#d95353"
GIT_CLEAN_b="#b3f58c"
GIT_CLEAN_f="#568459"
# Get openssl-1.1.1 tar gz
wget https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1t/openssl-1.1.1t.tar.gz
./config shared enable-ec_nistp_64_gcc_128 -Wl,-rpath=/usr/local/openssl/lib --prefix=/usr/local/openssl
make -j 4
make test && sudo make install
# Then finally install PHP 7
cd /usr/local/openssl
export PHP_OPENSSL_DIR=yes
PROMPT='%{$FG[255]%}%{$BG[068]%} %n@%m %{$reset_color%}%{$FG[255]%}%{$BG[025]%} %/ %{$reset_color%}$(git_prompt_info)
%(!.#.$) '
RPROMPT='%{$FG[255]%}%{$BG[068]%} %D{%H:%M:%S} %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$FG[255]%}%{$BG[071]%} "
ZSH_THEME_GIT_PROMPT_SUFFIX=" %{$reset_color%}"
<?php
include __DIR__ . "/vendor/autoload.php";
use Elastica\Client;
use Monolog\Formatter\LogstashFormatter;
use Monolog\Handler\ElasticSearchHandler;
use Monolog\Logger;
$logger = new Logger("MyApp");
@InFog
InFog / filter_email.php
Created January 15, 2018 14:49
Filter email in PHP
<?php
$validInput = "email@mail.com";
$invalidInput = "\"'/><script>alert(1)</script>";
echo "Valid: ";
echo filter_var($validInput, FILTER_VALIDATE_EMAIL);
echo PHP_EOL;
echo "Invalid: ";
@InFog
InFog / convertme.sh
Last active September 29, 2017 14:24
#!/bin/bash
FILE="$1"
TMP_FILE="$FILE.tmp"
if [ -f "$FILE" ]; then
IS_ISO=$(file -I "$FILE" | grep 8859)
if [ -n "$IS_ISO" ]; then
iconv -f iso-8859-1 -t utf-8 "$FILE" > "$TMP_FILE"
@InFog
InFog / infog.zsh-theme
Created May 16, 2017 17:30
Light Colorscheme for ZSH
PROMPT=$'
%{$fg[white]%}%n@%m%{$reset_color%} %{$fg[blue]%}[%/]%{$reset_color%} $(git_prompt_info)$(bzr_prompt_info)
%{$fg_bold[black]%}\$%{$reset_color%} '
PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}"
GIT_CB="git::"
ZSH_THEME_SCM_PROMPT_PREFIX="%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_PREFIX=$ZSH_THEME_SCM_PROMPT_PREFIX$GIT_CB
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
@InFog
InFog / alertme
Created October 25, 2016 08:18
Simple alert to use with cli on Macs
#!/bin/bash
title="$1"
message="$2"
param='display notification "'$2'" with title "'$1'"'
osascript -e "$param"
# Usage: alertme "Title" "Message"
@InFog
InFog / intrun
Created February 22, 2016 10:13
Python script to run a command every 2 seconds. I use it for unit tests
#!/usr/bin/env python2
#
# This script will run something every 2 seconds and print a line in between
#
# Usage: intrun command
from subprocess import call
from sys import argv, exit
from time import sleep
@InFog
InFog / escopos2.php
Created August 30, 2015 22:09
Mais escopos
<?php
$livro = 'O Senhor dos Aneis';
function mostraFilme()
{
$filme = 'O Hobbit';
echo $filme;
}