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
@cristopher-rodrigues
cristopher-rodrigues / mongobigagg.js
Created January 17, 2016 01:07
mongo + mongoose big aggregate $group
agregação var = MyModel.aggregate (...);
aggregation.options = {allowDiskUse: true};
aggregation.exec (function () {});
@cristopher-rodrigues
cristopher-rodrigues / indexes.js
Last active February 7, 2017 02:17
list all indexes on database (mongo)
db.getCollectionNames().forEach(function(collection) {
indexes = db[collection].getIndexes();
print("Indexes for " + collection + ":");
printjson(indexes);
});
@cristopher-rodrigues
cristopher-rodrigues / gist:d672e3cb276334906acb
Last active February 7, 2017 02:16
ssl example using node
openssl genrsa -out server-key.pem 2048
openssl req -new -key server-key.pem -out server-csr.pem
OR
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
and
openssl x509 -req -in server-csr.pem -signkey server-key.pem -out server-cert.pem
past in ssl provider: cat server-csr.pem
@cristopher-rodrigues
cristopher-rodrigues / set.js
Created March 10, 2016 12:42
topology destroyed (mongo+node+mongolab)
var options = {
server: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } },
replset: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } }
};
mongoose.connect(secrets.db, null, options);
@cristopher-rodrigues
cristopher-rodrigues / rename.js
Created March 10, 2016 12:43
mongo rename db
db.copyDatabase("oldDb","newDb","connection")
use oldDb
db.dropDatabase();
@cristopher-rodrigues
cristopher-rodrigues / gist:3b20aa34143c94302924213aa2b98122
Last active February 7, 2017 02:13
mongo verify replicaset connect

on broker server:

telnet ipReplica port: tenet 101.101.01.01 27017

on replica:

ufw status
@cristopher-rodrigues
cristopher-rodrigues / foo.java
Created August 4, 2016 18:24
Spring boot app context
// AppContext
@Configuration
@EnableAutoConfiguration
@ComponentScan(basePackages={"ebanx?"})
public class AppContext {
}
// Application
@SpringBootApplication
public class Application {
@cristopher-rodrigues
cristopher-rodrigues / bar.java
Created August 4, 2016 18:33
Generic Stack Spring
// BaseEntity
public abstract class BaseEntity<ID extends Serializable>
extends AbstractPersistable<ID>{
private static final long serialVersionUID = 1L;
@Override
public String toString(){
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

OLD

Download phpunit

wget https://phar.phpunit.de/phpunit-old.phar

Permittion to phpunit

chmod +x phpunit-old.phar

Move phpunit to bin sys

  1. Open ruby mine and on menu: tools => Create command line luncher =>

  2. on bash run:

bundle exec mine .