Skip to content

Instantly share code, notes, and snippets.

@debloper
debloper / xrandr.sh
Last active May 14, 2024 20:52
Add system unrecognized but monitor supported resolution in X
#!/bin/bash
# Copyright (c) 2021 Soumya Deb <debloper@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@EthraZa
EthraZa / DTB_2014_Municipios.sql
Last active May 10, 2021 04:17
Tabela simples (MySQL) com a lista atualizada de Códigos de Municípios do IBGE, com 7 dígitos, baseada na lista 2014 v2 em ftp://geoftp.ibge.gov.br/organizacao_territorial/divisao_territorial/2014/
CREATE TABLE IF NOT EXISTS `municipios` (
`id` int(7) NOT NULL,
`estado` varchar(19) COLLATE utf8_unicode_ci DEFAULT NULL,
`uf` char(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`municipio` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `municipios` (`id`, `estado`, `uf`, `municipio`) VALUES
(1100015, 'Rondônia', 'RO', 'Alta Floresta D\'Oeste'),
@sohelamin
sohelamin / drop-table
Created November 18, 2015 18:53
Laravel drop tables via artisan command
php artisan tinker
$tables = DB::select('SHOW TABLES');
$tables_in_database = "Tables_in_".Config::get('database.connections.mysql.database');
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
foreach ($tables as $table) {
Schema::drop($table->$tables_in_database);
}
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@EthraZa
EthraZa / Estados_array.json
Last active May 10, 2021 04:18
Array de Arrays com Estados[0] e Siglas[1] do Brasil. Baseado em https://github.com/felipefdl/cidades-estados-brasil-json
[
["Acre", "AC"],
["Alagoas", "AL"],
["Amazonas", "AM"],
["Amapá", "AP"],
["Bahia", "BA"],
["Ceará", "CE"],
["Distrito Federal", "DF"],
["Espírito Santo", "ES"],
["Goiás", "GO"],

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@flyingluscas
flyingluscas / UsingFakerInPT-BR.md
Last active July 27, 2024 13:13
Utilizando Faker em pt-BR

Utilizando Faker em pt-BR

Acesse o seu arquivo app/Providers/AppServiceProvider.php, e no método register adicione o seguinte :

/**
 * Register any application services.
 *
 * @return void
 */
@nottrobin
nottrobin / git-force-clone.sh
Created November 8, 2016 09:57
git force-clone: clone a repository; if it already exists locally, reset it to a clone of the remote.
#! /usr/bin/env bash
set -euo pipefail
_usage() {
echo "
Usage:
git-force-clone -b branch remote_url destination_path
Example:
@chronon
chronon / ext.txt
Created February 18, 2017 15:38
List of docker-php-ext-install extension names
Possible values for ext-name:
bcmath
bz2
calendar
ctype
curl
dba
dom
enchant
@simonhamp
simonhamp / AppServiceProvider.php
Last active June 12, 2024 11:05
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()