Skip to content

Instantly share code, notes, and snippets.

@usman-ahmad
usman-ahmad / rename_files_in_subdirs.rb
Created March 29, 2019 09:49
Rename files within sub directories when needed to pad a zero to files with single digit name start
def print_dir(home)
puts "BASE DIRECTORIES\n#{'=' * 17}\n"
puts Dir.entries(home).sort
Dir.entries(home).sort.each do |first|
next if File.file?(File.join(home, first)) || %w[. ..].include?(first)
puts "\nSUB DIRECTORIES [#{first}]\n#{'-' * 55}\n"
puts puts Dir.entries(File.join(home, first)).sort.map {|sec| File.join(first, sec)}
var page = require('webpage').create(),
system = require('system'),
t, address;
if (system.args.length === 1) {
console.log('Usage: loadspeed.js [some URL]');
phantom.exit();
}
@usman-ahmad
usman-ahmad / elastic_search_facets_issue
Created April 17, 2012 04:18
Facets are only showing local counts, I want to have counts like "linkedin.com" that are local but not include current term (i.e. color here).
# CREATE INDEX
curl -XPUT 'http://localhost:9200/computers/'
# CREATE MAPPING
curl -XPUT 'http://localhost:9200/computers/laptop/_mapping' -d '{
"laptop":{
"properties":{
"id":{
"type":"integer"
},