Skip to content

Instantly share code, notes, and snippets.

@dsoares
dsoares / reports.md
Created March 6, 2014 20:00
Some project report.

Relatórios Síntese







@dsoares
dsoares / csrf_prevention.php
Last active August 29, 2015 14:03
CSRF prevention in PHP (by injection)
<?php
// CSRF start
function store_in_session($key,$value)
{
if(isset($_SESSION)){$_SESSION[$key]=$value;}
}
function unset_session($key)
{
$_SESSION[$key]=' ';unset($_SESSION[$key]);
@dsoares
dsoares / .htaccess
Created September 16, 2016 09:23 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@dsoares
dsoares / slurp.pl
Last active October 12, 2016 10:31
Slurp with Perl
#!/usr/bin/perl
#
# 2014-11-19: dsoares
# also see https://metacpan.org/pod/File::Slurp
#
use strict;
use warnings;
use 5.010;
@dsoares
dsoares / keybase.md
Last active October 12, 2016 10:31
Keybase proof

Keybase proof

I hereby claim:

  • I am dsoares on github.
  • I am dsoares (https://keybase.io/dsoares) on keybase.
  • I have a public key whose fingerprint is A4AA CA49 E7B4 D472 B9F4 8361 2550 0CA2 E58D FC92

To claim this, I am signing this object:

@dsoares
dsoares / macports-opencv.md
Last active November 8, 2016 12:19
Howto create my own port for MacPorts (opencv)
date author log
2016-10-10
dsoares
Howto create my own port for MacPorts

Instalar opencv com o MacPorts

Veio a propósito do pedido de slopes com o comando:

@dsoares
dsoares / MyModel.php
Created March 7, 2017 20:06 — forked from havvg/MyModel.php
true MySQL ENUM with Propel
<?php
class MyModel extends BaseMyModel
{
public function hydrate($row, $startcol = 0, $rehydrate = false)
{
try {
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->type = ($row[$startcol + 1] !== null) ? $row[$startcol + 1] : null;
$this->resetModified();
@dsoares
dsoares / monolog.php
Created June 8, 2017 16:24 — forked from mamchenkov/monolog.php
Example use of Monolog logger
<?php
// Before: composer require monolog/monolog
// composer autoloader
require_once 'vendor/autoload.php';
// Shortcuts for simpler usage
use \Monolog\Logger;
use \Monolog\Formatter\LineFormatter;
use \Monolog\Handler\StreamHandler;
@dsoares
dsoares / macosx_sierra.md
Last active August 3, 2017 19:25
macosx_sierra.md

Issues with Mac OS X Sierra

1. Could not ssh from my Mac to my usual linux servers

The solution was to add this to my ssh config:

PubkeyAcceptedKeyTypes +ssh-dss
2. Macfusion says: "You can’t use this version of the application “Macfusion.app” with this version of macOS."
@dsoares
dsoares / macosx_sierra_amc.md
Last active March 16, 2018 11:29
Installing AMC development version on Mac OS X Sierra

Installing AMC development version on macOS

This document is based on this instructions: Installing AMC development version on macOS

UPDATE 2018-03-15

Comments were added to this gist with a method to install AMC with Homebrew. To choose your best installation option, please read them before installation.