Skip to content

Instantly share code, notes, and snippets.

View saden1's full-sized avatar

Sharmarke Aden saden1

View GitHub Profile
@saden1
saden1 / massrename.md
Last active December 24, 2015 13:59
Linux commandlines to mass rename files and content in those files

Mass Rename of Files

In Linux you can use the rename command to rename files in masses

# rename all coinsurance of 'Post' in the name of all java files in the
# current directory and  its sub-directories to 'Comment'

find -name "*.java" | xargs rename 's/Post/Comment/g'

Tuning Storm+Trident

Tuning a dataflow system is easy:

The First Rule of Dataflow Tuning:
* Ensure each stage is always ready to accept records, and
* Deliver each processed record promptly to its destination

Too Many Files Open

On Linux you might encounter an issue with too many files open at the same time during the building of the maven project or running while running the application server: To fix the issue do the following:

  1. Edit "/etc/sysctl.conf" as a super user:
sudo gedit /etc/sysctl.conf
  1. Make sure the below flag is set to 200000 or higher:
#set to 2^18 = 262144
fs.file-max = 262144
@saden1
saden1 / weblogic.version.sh
Created November 6, 2014 00:32
Determine Weblogic Version
#Go to directory which contains weblogic.jar ($WL_HOME/server/lib) and run below command
java -cp weblogic.jar weblogic.version
@saden1
saden1 / nginx.conf
Last active August 29, 2015 14:14 — forked from maryo/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
@saden1
saden1 / nginx.conf
Last active August 29, 2015 14:14 — forked from calebwoods/nginx.conf
server { listen 80;
server_name example.com;
access_log /var/log/example.com/nginx.access.log;
error_log /var/log/example.com/nginx.error.log;
root /var/www/apps/example.com/public;
charset utf-8;
location / {
rewrite ^ https://$host$request_uri? permanent;
}
@saden1
saden1 / raid.yml
Last active October 28, 2015 07:50 — forked from suprememoocow/raid.yml
- action: ec2_facts
- apt: pkg=lvm2 state=present
- apt: pkg=mdadm state=present
- pip: name=boto state=latest
- ec2_vol: instance="{{ hostvars[inventory_hostname]['ansible_ec2_instance-id'] }}"
volume_size=20
device_name="{{ item }}"
@saden1
saden1 / hosts
Last active August 29, 2015 14:14 — forked from davestern/hosts
ec2-1-2-3-4.compute-1.amazonaws.com new_hostname=new-hostname.example.com
ec2-5-6-7-8.compute-1.amazonaws.com
@saden1
saden1 / mass_rename.sh
Created February 16, 2015 20:29
File Rename and Content Replace
# rename all occurrences of 'Post' in the name of all java files
# in the current directory and its sub-directories to 'Comment'
find -name "*.java" | xargs rename 's/Post/Comment/g'
gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
==>titangraph[berkeleyje:/tmp/test]
gremlin> mgmt = g.getManagementSystem();
==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@27c04377
gremlin> id = mgmt.makePropertyKey("uid").dataType(Long.class).make()
==>uid
gremlin> mgmt.buildIndex('byUID',Vertex.class).addKey(id).buildCompositeIndex()
==>com.thinkaurelius.titan.graphdb.database.management.TitanGraphIndexWrapper@14f3c6fc
gremlin> mgmt.commit()
gremlin> for (int i=0;i<200;i++) { v = g.addVertex([uid:(int)Math.floor(i/2)])}