Skip to content

Instantly share code, notes, and snippets.

View cristopher-rodrigues's full-sized avatar
🏠
Working from home

Cristopher Rodrigues cristopher-rodrigues

🏠
Working from home
View GitHub Profile

2014/12/09

PHP HHVM +18

CGI, FASTCGI, WSGI, FPM

Cache, mod_php, compiladores opcodes

HHVM (Instalando e configurando), Hack Lang

@cristopher-rodrigues
cristopher-rodrigues / makeConstraints.php
Last active December 10, 2015 03:03
Make Constraints Class (SF&Doctrine)
<?php
use DMS;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\Validator;
class makeConstraints {
git filter-branch --commit-filter
'
if [ "$GIT_COMMITTER_NAME" = "cristopher" ];
then
GIT_COMMITTER_NAME="cristopher-rodrigues";
GIT_AUTHOR_NAME="cristopher-rodrigues";
GIT_COMMITTER_EMAIL="cristopher.rodrigues993@gmail.com";
GIT_AUTHOR_EMAIL="cristopher.rodrigues993@gmail.com";
git commit-tree "$@";
else
@cristopher-rodrigues
cristopher-rodrigues / user_model.js
Last active October 28, 2015 20:04
user model mongoose with password
var mongoose = require("mongoose"),
Schema = mongoose.Schema,
bcrypt = require("bcrypt"),
SALT_WORK_FACTOR = 10;
var UserSchema = new Schema({
username: { type: String, required: true, index: { unique: true } },
password: { type: String, required: true }
});
@cristopher-rodrigues
cristopher-rodrigues / ssh.markdown
Last active July 11, 2020 17:02
SSH POWER BASH
SOUND WHEN GET A RESPONSE

ping -i 60 -a ADDRESS
S.O/HARD INFOS

/* LET: scope vars */
let foo = "bar";
console.log(foo);
if(foo.includes("bar")){
let inc = true;
}
console.log(inc);
/*CONST: constants vars */
const PI = 3.14;
@cristopher-rodrigues
cristopher-rodrigues / index.js
Last active December 14, 2015 12:44
mongo index text search
//For a specified field
db.collectionname.createIndex(
{ "field_name": "text" },
{ name: "TextIndex" }
)
//For All Fields
db.collectionname.createIndex(
{ "$**": "text" },
{ name: "TextIndex" }
@cristopher-rodrigues
cristopher-rodrigues / os.sh
Last active December 10, 2015 02:51
detect os
if [[ "$OSTYPE" == "linux-gnu" ]]; then
printf "\e[97mlinux-gnu ☂\n";
elif [[ "$OSTYPE" == "darwin"* ]]; then
printf "\e[97mdarwin \n";
else
echo "☠ WTF? ☠;
fi
@cristopher-rodrigues
cristopher-rodrigues / mongo_bkp.markdown
Last active December 2, 2015 13:09
Mongo copy last data (SIMPLE BKP)

Create script on server

/root/mongo_bkp.sh

rm -rf /root/dump* && mongodump && tar -cvf dump.tar dump/

Exec script

ssh user@machine /root/mongo_bkp.sh
sudo dscacheutil -flushcache;
sudo killall -HUP mDNSResponder;say flushed

Clear MDNS Cache

sudo discoveryutil mdnsflushcache