Skip to content

Instantly share code, notes, and snippets.

Cristian Dugacicu razorcd

Block or report user

Report or block razorcd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@razorcd
razorcd / install-rabbitmq.sh
Created Oct 5, 2018 — forked from yetanotherchris/install-rabbitmq.sh
RabbitMQ on Docker with admin UI
View install-rabbitmq.sh
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
@razorcd
razorcd / custom_flux_emitter.java
Created Aug 20, 2018
Flux: custom emitter simulation
View custom_flux_emitter.java
/**
* Custom emitter.
*/
@GetMapping(value = "/custom-emitter", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<String> getCustomEmitter() {
EmitterProcessor<String> hotSource = EmitterProcessor.create();
Flux<String> hotFlux = hotSource.publish().autoConnect();
@razorcd
razorcd / es_create_document.md
Last active Aug 2, 2018
Elasticsearch - CRUD document sync
View es_create_document.md

CREATE

POST localhost:9200/index/type?refresh

{
  "ssoId": "s0000000001",
  "externalSsoType": "U",
  "socketNumber": "s0000000001",
  "deviceNote": null,
  "isTaken": null,
View copy_columns_to_new_table.sql
-- MIGRATION1: (copy data)
-- create new table
CREATE TABLE cdm.adresses (
id BIGINT(20) AUTO_INCREMENT PRIMARY KEY,
enrichment_erp_id BIGINT(20) UNIQUE NOT NULL,
latitude DECIMAL(20,6) NOT NULL,
longitude DECIMAL(20,6) NOT NULL,
zip_code VARCHAR(20) NOT NULL,
street VARCHAR(255),
@razorcd
razorcd / gist:f44320c64347bd09943d625322485b6b
Created Jun 16, 2018 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
View gist:f44320c64347bd09943d625322485b6b
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@razorcd
razorcd / create_user.commands
Last active Jun 20, 2018
create user in mongo db
View create_user.commands
//login as admin using the db where the admin user is defined
mongo --port 27017 -u "admin" -p "admin" --authenticationDatabase "admin"
// or the default:
mongo --port 27017 -u "root" -p "password" --authenticationDatabase "root"
//list all system users:
db.system.users.find()
View parse.js
var fs = require('fs');
var content = readFile("19_3_2018log.txt");
var allLines = getLines(content);
console.log("All lines:");
console.log(allLines);
var result = allLines.map(line => parseLineToObject(line));
console.log("Result:");
console.log(result);
@razorcd
razorcd / subtree_merge.sh
Last active Jan 14, 2018
Git Subtree merging while keeping the commits
View subtree_merge.sh
# add remote repo from another filepath:
git remote add -f springBootSippetsFullRepo ../1/spring-boot-snippets-full-folder
# merge to current master (will not messup original files)
git merge -s ours springBootSippetsFullRepo/master
# move new repo in a subfolder:
git read-tree --prefix=springBootSnippets -u springBootSippetsFull/master
# comit new folder:
@razorcd
razorcd / ES_contracts_for_interval.txt
Last active May 17, 2017
Contracts based on a range intersection where validTo can be null
View ES_contracts_for_interval.txt
{
"size": 9999999,
"query": {
"bool": {
"must": [
{
"nested": {
"path": "contractAttributions",
"query": {
"bool": {
View gist:31c9ccddc78dd2a2f30f9135cd1002b6
POST http://localhost:9200/devices/_search
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "contractAttributions",
"query": {
"bool": {
You can’t perform that action at this time.