Skip to content

Instantly share code, notes, and snippets.

Marcelo de Andrade marcelodeandrade

Block or report user

Report or block marcelodeandrade

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
@marcelodeandrade
marcelodeandrade / backup_restore_mysql_docker.sh
Last active Apr 15, 2019
Backup n' Restore MySQL on Docker
View backup_restore_mysql_docker.sh
# Backup
docker exec -i DOCKER_CONTAINER_ID /usr/bin/mysql --user=root --password=root -h 127.0.0.1 DATABASE > backup.sql
# Restore
docker exec -i DOCKER_CONTAINER_ID /usr/bin/mysql --user=root --password=root -h 127.0.0.1 < backup.sql
docker exec -i $(docker ps -qf "name=superlogica-mysql") /usr/bin/mysql --user=root --password=root -h 127.0.0.1 < backup.sql
View response.php
<?php
header('Content-Type: application/json');
header('HTTP/1.1 401 Unauthorized');
$data = [
'status' => 401,
'message' => '401 Unauthorized'
];
@marcelodeandrade
marcelodeandrade / typeValue.asp
Last active Nov 13, 2018
Convert value by recordset value type
View typeValue.asp
public function typeValue(value)
select case TypeName(value)
case "Byte": typeValue = cBool(value)
case "Integer": typeValue = cInt(value)
case "Long": typeValue = cLng(value)
case "Single": typeValue = cDbl(value)
case "Double": typeValue = cDbl(value)
case "Currency": typeValue = cDbl(value)
case "Decimal": typeValue = cDbl(value)
case "Date": typeValue = cDate(value)
@marcelodeandrade
marcelodeandrade / dynamic_get_set.asp
Last active Nov 8, 2018
Dynamic get/set properties
View dynamic_get_set.asp
<%
class teste
private abc
private def
private sub class_initialize
end sub
View docker_clear.sh
# Credits to @marcelmfs in https://github.com/moby/moby/issues/23371#issuecomment-224927009
# Containers
docker rm -f $(docker ps -a -q)
# Images
docker rmi -f $(docker images -a -q)
# Volumes
docker volume rm $(docker volume ls -q)
View truncate_table_with_fks.sql
DELETE FROM database.dbo.table
DBCC CHECKIDENT ('database.dbo.table', RESEED, 0)
@marcelodeandrade
marcelodeandrade / composer-private-package-github-token.md
Created Aug 31, 2018 — forked from jeffersonmartin/composer-private-package-github-token.md
Generate a GitHub Personal Access Token for Private Composer Packages
View composer-private-package-github-token.md

Generate a GitHub Personal Access Token for Private Composer Packages

If you're trying to load a private repository with Composer/Laravel, we'll need to generate a GitHub Personal Access Token (similar to OAuth token) to access the repository during a composer install without entering credentials.

If you have used other Github packages from {my-org} before, you may be able to skip this step.

  1. Visit https://github.com/settings/tokens.

  2. Click Generate new token.

View git_push_default.sh
# see https://git-scm.com/docs/git-config#git-config-pushdefault
git config --global push.default current
@marcelodeandrade
marcelodeandrade / search_in_sys_objects.sql
Created Jul 17, 2018
Search in SQL Server [sys.objects]
View search_in_sys_objects.sql
SELECT DISTINCT
type AS object_type,
type_desc AS object_type_desc,
SCHEMA_NAME(schema_id) AS schema_name,
name AS object_name,
OBJECT_DEFINITION(object_id) AS object_source
FROM sys.objects
WHERE OBJECT_DEFINITION(object_id) LIKE '%search_string%'
AND (
type_desc LIKE '%VIEW%'
@marcelodeandrade
marcelodeandrade / object_types.MD
Last active Jul 17, 2018
SQL SERVER object types
View object_types.MD
type type_desc
AF Aggregate function (CLR)
C CHECK constraint
D Default or DEFAULT constraint
F FOREIGN KEY constraint
FN Scalar function
FS Assembly (CLR) scalar-function
FT Assembly (CLR) table-valued function
IF In-lined table-function
You can’t perform that action at this time.