Skip to content

Instantly share code, notes, and snippets.

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

Paulo Cesar pocesar

🏠
Working from home
View GitHub Profile
@ikasty
ikasty / README.md
Last active February 1, 2019 21:47
'Cat' solution for colorized logs in docker-compose

When you use docker-compose, logs are not colorized like: before

However, you can get colorized logs using really-cute-'cat' solution. Instead of

docker-compose up

using

docker-compose up | cat
@angristan
angristan / hosts
Last active May 31, 2020 15:00
Windows 10 Privacy Hosts file
0.0.0.0 choice.microsoft.com
0.0.0.0 choice.microsoft.com.nsatc.net
0.0.0.0 df.telemetry.microsoft.com
0.0.0.0 diagnostics.support.microsoft.com
0.0.0.0 feedback.microsoft-hohm.com
0.0.0.0 feedback.search.microsoft.com
0.0.0.0 feedback.windows.com
0.0.0.0 oca.telemetry.microsoft.com
0.0.0.0 oca.telemetry.microsoft.com.nsatc.net
0.0.0.0 onesettings-bn2.metron.live.com.nsatc.net
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@schempy
schempy / stream-file-upload-s3-nodejs.js
Last active March 11, 2024 10:20
Streaming File Uploads To Amazon S3 With Node.js
var http = require('http');
var router = require('routes')();
var Busboy = require('busboy');
var AWS = require('aws-sdk');
var inspect = require('util').inspect;
var port = 5000;
// Define s3-upload-stream with S3 credentials.
var s3Stream = require('s3-upload-stream')(new AWS.S3({
accessKeyId: '',
@tlrobinson
tlrobinson / post-receive
Last active December 7, 2022 08:15
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f
@ProLoser
ProLoser / AngularJS-Cachebusting.js
Last active September 10, 2020 12:54
Elegant cache-busting for AngularJS HTML assets
anglar.module('myApp',['ui']).config(["$provide", function($provide) {
return $provide.decorator("$http", ["$delegate", function($delegate) {
var get = $delegate.get;
$delegate.get = function(url, config) {
// Check is to avoid breaking AngularUI ui-bootstrap-tpls.js: "template/accordion/accordion-group.html"
if (!~url.indexOf('template/')) {
// Append ?v=[cacheBustVersion] to url
url += (url.indexOf("?") === -1 ? "?" : "&");
url += "v=" + cacheBustVersion;
}
@ricardobarantini
ricardobarantini / estados.php
Last active December 12, 2023 19:04
Array com nome e siglas de estados Brasileiros para select do Codeigniter
$estadosBrasileiros = array(
'AC'=>'Acre',
'AL'=>'Alagoas',
'AP'=>'Amapá',
'AM'=>'Amazonas',
'BA'=>'Bahia',
'CE'=>'Ceará',
'DF'=>'Distrito Federal',
'ES'=>'Espírito Santo',
'GO'=>'Goiás',
@pocesar
pocesar / get domain without subdomain.php
Created April 11, 2013 20:27
PHP code to get the domain name without subdomains (includes the tld, and the special types from IANA). Don't have support for unicode domain names.
<?php
/**
* @param string $domain Pass $_SERVER['SERVER_NAME'] here
* @param bool $debug
*
* @debug bool $debug
* @return string
*/
function get_domain($domain, $debug = false)
{
@taterbase
taterbase / system-beep.js
Created July 21, 2012 05:01
System Beep in Node.js
function alertTerminal(){
console.log("\007");
}