Skip to content

Instantly share code, notes, and snippets.

View bergpb's full-sized avatar
💻
https://blog.bergpb.dev

Lindemberg Barbosa bergpb

💻
https://blog.bergpb.dev
View GitHub Profile
@bergpb
bergpb / ansible-github.yml
Created January 11, 2021 14:12 — forked from devynspencer/ansible-github.yml
Example playbook for cloning a private git repository with Ansible.
---
hosts: all
tasks:
- name: add github ssh key
copy: >
src=files/id_rsa.github
dest=/root/.ssh/id_rsa.github
owner=root
group=root
@bergpb
bergpb / semantic-commit-messages.md
Created January 10, 2021 16:28 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@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 / 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

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 / how-to-use-pelican.md
Created April 22, 2020 15:16 — forked from JosefJezek/how-to-use-pelican.md
How to use Pelican on GitHub Pages
@bergpb
bergpb / git-deployment.md
Created January 4, 2020 19:06 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@bergpb
bergpb / git.md
Created January 4, 2020 19:05 — forked from pedronauck/git.md
Terminal commands

Comandos Gerais

Clonar um Repositório

$ git clone 'nome-do-repositório'

Verificar status

$ git status
@bergpb
bergpb / mysql.database.yml
Created December 15, 2019 23:55 — forked from jwo/mysql.database.yml
Sample config/database.yml from Rails. Postgres, MySQL, and SQLite
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
@bergpb
bergpb / will_paginate in Sinatra.md
Created June 27, 2019 13:11 — forked from ChengLong/will_paginate in Sinatra.md
Use will_paginate with ActiveRecord in Sinatra
  1. Add gem 'will_paginate', '~> 3.0' to Gemfile
  2. Add %w(will_paginate will_paginate/active_record).each {|lib| require lib} to config.ru
  3. Assuming modular Sinatra, open Sinatra::Base and add include WillPaginate::Sinatra::Helpers so that all views can use will_paginate
  4. In controller, @users = User.paginate(:page => params[:page], :per_page => 30)
  5. In view, = will_paginate @users will generate the pagers

If you want to style your pagers

  • Include this css in your layout
  • Style it