Skip to content

Instantly share code, notes, and snippets.

View bergpb's full-sized avatar
🏠
Working from home

Lindemberg Barbosa bergpb

🏠
Working from home
View GitHub Profile
@bergpb
bergpb / .gitconfig
Created January 7, 2021 19:23 — forked from lifuzu/.gitconfig
Three levels of GIT config
# There are 3 levels of git config; project, global and system.
# project: Project configs are only available for the current project and stored in .git/config in the project's directory.
# global: Global configs are available for all projects for the current user and stored in ~/.gitconfig.
# system: System configs are available for all the users/projects and stored in /etc/gitconfig.
# Create a project specific config, you have to execute this under the project's directory.
$ git config user.name "John Doe"
# Create a global config
@bergpb
bergpb / frases_christian_profanus.txt
Last active March 31, 2021 23:44
Frases de Chris (Profanus) Cardoso
Sim.
Não.
Seja criativo e analógico pois a calcanheza ébria te torna obsoleto.
A lógica é um método para chegar a uma conclusão errada com confiança.
Um despertar é como acordar as vezes é melhor do que enxergar.
Acreditar que não acreditamos em nada é crer na crença do descrer.
Um homem sem propósito é um homem incalcanhável.
A derrota só existe para os perdedores.
Nem tudo aquilo que você vê é aquilo que você enxerga.
Leia um livro, hitrate-se, coma polenta e diga gratidão.
@bergpb
bergpb / install_stremio.sh
Last active November 22, 2020 23:09
Install Stremio in Linux
# https://www.edivaldobrito.com.br/como-instalar-o-stremio-no-ubuntu-debian-e-derivados/
wget https://dl.strem.io/shell-linux/v4.4.116/stremio_4.4.116-1_amd64.deb -O stremio.deb
sudo dpkg -i stremio.deb
sudo apt-get install -f
wget http://archive.ubuntu.com/ubuntu/pool/universe/x/x264/libx264-152_0.152.2854+gite9a5903-2_amd64.deb
@bergpb
bergpb / Program.cs
Created August 19, 2020 19:46
Outro exemplo de Extension Methods no C#
using System
public class ProcessFile
{
public static void Main()
{
string s1 = "Good morning dear students";
Console.WriteLine(s1.Cut(0));
}
}
@bergpb
bergpb / DateTimeExtensions.cs
Created August 19, 2020 19:37
Exemplo de Extension Methods in C#
using System.Globalization
namespace System
{
static class DateTimeExtensions
{
public static string ElapsedTime(this Datime thisObj)
{
TimeSpan duration = DateTime.Now.Subtract(thisObj);
@bergpb
bergpb / bitbucket-pipelines.yml
Created August 15, 2020 20:21 — forked from mcnamee/bitbucket-pipelines.yml
Bitbucket Pipelines - Deploy via FTP to shared hosting
# Installation ---
# 1. In Bitbucket, add $FTP_USERNAME $FTP_PASSWORD and $FTP_HOST as environment variables.
# 2. Commit this file to your repo
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initial GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (from Bitbucket Cloud) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud) - if multiple deploys fail, you
@bergpb
bergpb / install_composer.sh
Created August 15, 2020 19:28
Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '572cb359b56ad9ae52f9c23d29d4b19a040af10d6635642e646a7caa7b96de717ce683bd797a92ce99e5929cc51e7d5f') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
@bergpb
bergpb / send_fake_data.py
Created August 11, 2020 16:55
Send fake data to phishing web pages
import requests
import random
import string
from faker import Faker
from time import sleep
faker = Faker()
def get_random_alphanumeric_string(letters_count, digits_count):
sample_str = ''.join((random.choice(string.ascii_letters) for i in range(letters_count)))

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@bergpb
bergpb / http_dolarhj.go
Created June 2, 2020 19:16
Scrapy de páginas com o a linguagem Go
package main
import (
"fmt"
"log"
"github.com/anaskhan96/soup"
)
var coinsURL = []string{