Skip to content

Instantly share code, notes, and snippets.

Marcelo Diniz marcelod

Block or report user

Report or block marcelod

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@marcelod
marcelod / main
Created Jun 13, 2019 — forked from tgfarias/main
Docker commands
View main
#Start docker
docker-compose up -d --build --force-recreate
#Import database
docker exec -i [container] mysql -u[user] -p[pass] [database] -v < [path_of_sql_import]
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE > backup.sql
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | gzip > backup.sql.gz
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | bzip2 > backup.sql.bz2
@marcelod
marcelod / git-pull-all
Created Jul 12, 2018 — forked from grimzy/git-pull-all
Git pull all remote branches
View git-pull-all
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
View gist:74162a499b13f4490587c771774bfb77

Parte do servidor

  • acessar via ssh o servidor, por exemplo ssh user@ip
  • no servidor, acessar a pasta do projeto, por exemplo, /var/www/meu-projeto/
  • criar e acessar a pasta, por exemplo app.git (mkdir app.git && cd app.git)
  • dentro de app.git, executar o comando git init --bare para criar um repositório mínimo git
  • criar um arquivo chamado post-receive dentro de app.git/hooks - nano hooks/post-receive e adicionar o seguinte conteúdo
#!/bin/sh
@marcelod
marcelod / gist:f86265a22dba3552d2d2cd4330e1eb10
Last active Dec 13, 2017
my help upgrade codeigniter version 2 to 3
View gist:f86265a22dba3552d2d2cd4330e1eb10
// usei para renomear os arquivos com extensão php para a primeira letra de cada arquivo para maiuscula
rename -v 's{ (\A|\s) (\w+) }{$1\u$2}xmsg' *.php
// atualizar a parte tabela do banco de dados
https://codeigniter.com/user_guide/libraries/sessions.html#database-driver
DROP TABLE ci_sessions;
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(128) NOT NULL,
`ip_address` varchar(45) NOT NULL,
@marcelod
marcelod / googleChartColors.js
Created Nov 22, 2017 — forked from rzds/googleChartColors.js
Google Chart Colors List
View googleChartColors.js
var googleChartColors = [
'#3366CC', '#DC3912', '#FF9900', '#109618',
'#990099', '#3B3EAC', '#0099C6', '#DD4477',
'#66AA00', '#B82E2E', '#316395', '#994499',
'#22AA99', '#AAAA11', '#6633CC', '#E67300',
'#8B0707', '#329262', '#5574A6', '#3B3EAC'
];
View initials.php
<?php
/**
* @param string $string
* @param array $avoid (['de', 'da', 'a', 'e', 'o'])
* @return string
*/
function initials(string $string, array $avoid = null): string
{
$words = preg_split("/\s+/", $string);
View initials.php
<?php
/**
* @param string $string
* @param array $avoid (['de', 'da', 'a', 'e', 'o'])
* @return string
*/
function initials(string $string, array $avoid = null): string
{
$words = preg_split("/\s+/", $string);
@marcelod
marcelod / cpf_consulta_api_sus.py
Created Dec 5, 2016 — forked from jh00nbr/cpf_consulta_api_sus.py
Script simples para consulta de dados na base dados nacional do SUS utilizando o CPF.
View cpf_consulta_api_sus.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests,json,sys
# Script simples para consulta de dados na base dados nacional do SUS utilizando o CPF.
# Jhonathan Davi A.K.A jh00nbr / Insightl4b lab.insightsecurity.com.br
# Blog: lab.insightsecurity.com.br
# Github: github.com/jh00nbr
# Twitter @jh00nbr
You can’t perform that action at this time.