Skip to content

Instantly share code, notes, and snippets.

View mreis1's full-sized avatar

Reis mreis1

View GitHub Profile
@mreis1
mreis1 / iconv-l.txt
Created June 26, 2018 10:11 — forked from hakre/iconv-l.txt
Iconv List of Encodings
ANSI_X3.4-1968 ANSI_X3.4-1986 ASCII CP367 IBM367 ISO-IR-6 ISO646-US ISO_646.IRV:1991 US US-ASCII CSASCII
UTF-8
ISO-10646-UCS-2 UCS-2 CSUNICODE
UCS-2BE UNICODE-1-1 UNICODEBIG CSUNICODE11
UCS-2LE UNICODELITTLE
ISO-10646-UCS-4 UCS-4 CSUCS4
UCS-4BE
UCS-4LE
UTF-16
UTF-16BE
@mreis1
mreis1 / disable_all_triggers_on_firebird.sql
Created June 26, 2018 08:11 — forked from martinusso/disable_all_triggers_on_firebird.sql
Enable/Disable all Triggers on a Firebird database
update
rdb$triggers
set
rdb$trigger_inactive = 1
where
rdb$trigger_source is not null
and (coalesce(rdb$system_flag,0) = 0)
and rdb$trigger_source not starting with 'CHECK'
@mreis1
mreis1 / .htaccess
Created May 31, 2018 07:38 — 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/
@mreis1
mreis1 / gist:b89b62393f962c60e95cede7ab7b7800
Created April 4, 2018 12:31 — forked from kylefox/gist:4512777
If you want to use Xcode's FileMerge as your git mergetool, this is how you set it up.
# Tell system when Xcode utilities live:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# Set "opendiff" as the default mergetool globally:
git config --global merge.tool opendiff
@mreis1
mreis1 / mongod.conf
Created March 19, 2018 13:23 — forked from cesare/mongod.conf
MacOSX launchd plist file to start MongoDB server
dbpath = /var/mongo/data
logpath = /var/mongo/logs/mongod.log
@mreis1
mreis1 / node-cluster-messaging.js
Created January 25, 2018 18:02 — forked from jpoehls/node-cluster-messaging.js
Simple message passing between cluster master and workers in Node.js
var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.
@mreis1
mreis1 / mongo-autostart-osx.md
Created August 21, 2017 07:12 — forked from subfuzion/mongo-autostart-osx.md
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

@mreis1
mreis1 / crypto-stream.js
Created July 26, 2017 20:09 — forked from chris-rock/crypto-stream.js
Encrypt and decrypt streams
// Part of https://github.com/chris-rock/node-crypto-examples
// Nodejs encryption of buffers
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
var fs = require('fs');
var zlib = require('zlib');
@mreis1
mreis1 / bcast.js
Created June 7, 2017 14:03 — forked from josuesasilva/bcast.js
Broadcast UPD Node.js
var dgram = require('dgram');
var server = dgram.createSocket("udp4");
// server
server.bind(function() {
server.setBroadcast(true)
server.setMulticastTTL(128);
broadcastNew();
});
@mreis1
mreis1 / gist:ac2da3c82e752606b2386b1dddf8c0c4
Created May 22, 2017 10:19 — forked from levicook/gist:4132037
modeling friends and calculating mutual friends w/ mongodb
// ------------------------------------------------------------------
// Friend collection, where _id is a user.Id and Friends is a list, of user.Id.
// Note: friending and unfriending is a two step operation in this scheme:
> db.friends.find()
{ "_id" : 1, "friends" : [ 2, 3, 4 ] }
{ "_id" : 2, "friends" : [ 1, 3, 5 ] }
{ "_id" : 3, "friends" : [ 1, 2, 4, 5 ] }
{ "_id" : 4, "friends" : [ 1, 3, 5 ] }
{ "_id" : 5, "friends" : [ 2, 3, 4 ] }