Skip to content

Instantly share code, notes, and snippets.

View diguinhorocks's full-sized avatar
🤘

Rodrigo Santiago Motta diguinhorocks

🤘
  • Itararé - São Paulo
View GitHub Profile
@diguinhorocks
diguinhorocks / docker_permission_repair.sh
Created May 3, 2021 18:28
Fix Docker service permission on sock file (Ubuntu 18.04)
sudo setfacl --modify user:(your user here):rw /var/run/docker.sock
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@diguinhorocks
diguinhorocks / chmod-400.cmd
Created June 5, 2020 08:48 — forked from jaskiratr/chmod-400.cmd
Set permission of file equivalent to chmod 400 on Windows.
# Source: https://stackoverflow.com/a/43317244
$path = ".\aws-ec2-key.pem"
# Reset to remove explict permissions
icacls.exe $path /reset
# Give current user explicit read-permission
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)"
# Disable inheritance and remove inherited permissions
icacls.exe $path /inheritance:r
@diguinhorocks
diguinhorocks / user.js
Last active August 29, 2015 14:03
Mongoose User
/**
* Module dependencies.
*/
var mongoose = require('mongoose')
, Schema = mongoose.Schema
, crypto = require('crypto')
, _ = require('underscore')
, authTypes = ['github', 'twitter', 'facebook', 'google']
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
<?php
class Extension implements IFacExtension
{
public function add()
{
}
public function read()
{
@diguinhorocks
diguinhorocks / Request.php
Last active September 20, 2019 16:07
Simple Google Custom Search API requester
<?php
class Request
{
protected $url;
protected $request;
protected $response;
protected $curl;
@diguinhorocks
diguinhorocks / robot.js
Created December 5, 2012 23:57
r'santiago
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(300);
@diguinhorocks
diguinhorocks / ModelGen.php
Created June 2, 2012 19:33
Library which generates some model stuff (attributes, magic getter, setter) for any application. Make sure the path to models is writable.
<?php
class ModelGen extends MysqlMapper{
protected $modelName;
protected $model = null;
protected $extends = 'extends MysqlActiveRecord';
@diguinhorocks
diguinhorocks / PaypalRequest.php
Created April 29, 2012 09:45
PaypalRequest Class (Express Checkout)
<?php
/**
*
* Paypal Request Class.
*
* Classe que adiciona os produtos e cria a requisição para a API Paypal utilizando o Express Checkout.
*
* @author R'Santiago.
* @license http://opensource.org/licenses/gpl-license.php GNU Public License