Skip to content

Instantly share code, notes, and snippets.

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

Michael Bastos bastosmichael

🏠
Working from home
View GitHub Profile
@bastosmichael
bastosmichael / fstab
Last active August 29, 2015 14:03
/etc/fstab
/dev/sdb1 /home/michael/Media1 ext4 defaults 0 1
//192.168.1.104/TV /media/TV cifs guest 0 0
//192.168.1.104/TV-Christina /media/TV-Christina cifs guest 0 0
//192.168.1.104/TV-Kids /media/TV-Kids cifs guest 0 0
//192.168.1.104/TV-Michael /media/TV-Michael cifs guest 0 0
//192.168.1.104/Movies /media/Movies cifs guest 0 0
//192.168.1.104/Music /media/Music cifs guest 0 0
//192.168.1.104/Photos /media/Photos cifs guest 0 0
//192.168.1.104/Training /media/Training cifs guest 0 0
@bastosmichael
bastosmichael / .travis.yml.PR_PUSH_EXAMPLE
Last active August 29, 2015 14:03
Push from working branch into master once PR closes using TravisCI and travis gem
after_success:
- if [ $TRAVIS_PULL_REQUEST == "false" ]; then
- git config --global user.email "${GIT_EMAIL}"
- git config --global user.name "${GIT_NAME}"
- git pull origin master
- git remote add travis "https://${GH_TOKEN}@github.com/username/some-branch.git"
- git push travis "${TRAVIS_BRANCH}":master
- fi
env:
global:
@bastosmichael
bastosmichael / gitlab7.0.sh
Last active August 29, 2015 14:03
Gitlab 7.0 Ubuntu 14.04 Postgres Install
#!/bin/bash
if [ $# -eq 0 ]
then
echo "gitlab.sh [options] install
elif [ $1 == 'install' ]; then
echo "Updating Operating System..."
sudo apt-get update -y
module Search
class Indexer
include Sidekiq::Worker
sidekiq_options queue: :low, retry: false, backtrace: true
LOGGER = Sidekiq.logger.level == Logger::DEBUG ? Sidekiq.logger : nil
SEARCH_POOL = ConnectionPool.new(size: SEARCH_UPDATE_POOL, timeout: 5) do
Elasticsearch::Client.new host: ELASTICSEARCH_URL, logger: LOGGER
end
Verifying that +bastosmichael is my blockchain ID. https://onename.com/bastosmichael
@bastosmichael
bastosmichael / gist:ff3006268a647858824a
Last active September 26, 2019 15:34
Facebook Graph API data available
business - The Business associated with this Page. Visible only with a page access token or a user access token that has admin rights on the page
can_checkin - Whether this page has checkin functionality enabled - bool
can_post - Whether the current session user can post on this Page - bool
category - The Page's category. e.g. Product/Service, Computers/Technology - string
category_list - The Page's sub-categories - list<pagecategory>
@bastosmichael
bastosmichael / gist:9db6e76bf14f108e2415
Last active March 11, 2016 00:40
User information
facebook_ids = [
"cirospizzeriabeerhousegaslamp",
"lavalenciahotel",
"tendergreensfood",
"craftpizzaco",
"tapiocaexpress",
"singlefinsd",
"thebakedbear",
"artofespresso",
"julianbakery",
@bastosmichael
bastosmichael / gist:9a6ca3fc2c2fdd5abf1abf0a705ea51a
Last active June 1, 2018 04:01
Adding minutes in ruby without using Time Objects
def add_minutes(time, signed_integer_minutes)
if time_regex = time.match(/(\d{1,2}+):(\d{2}+) (AM|PM)/)
total_minutes = time_regex[2].to_i + (signed_integer_minutes.abs % 60)
final_minutes = total_minutes % 60
total_hours = time_regex[1].to_i + (signed_integer_minutes.abs / 60 % 60) + (total_minutes / 60 % 60)
final_modulo_hours = total_hours % 12
module BattleShip
class Board
SHIPS = {C: 5, B: 4, S: 3, D: 3, T: 2}
def initialize
@grid = (1...10).map {(1...10).map {'.' }}
end
def randomly_load_ships
SHIPS.each do |ship,cells|
const liters = {canonical: 'liters',
metric: [{type: 'milliliters',
to: {divide: 1000},
from: {multiply: 1000}},
{type: 'centiliters',
to: {divide: 100},
from: {multiply: 100}},
{type: 'deciliters',
to: {divide: 10},
from: {multiply: 10}},