Skip to content

Instantly share code, notes, and snippets.

View midhunkrishna's full-sized avatar

Midhun Krishna midhunkrishna

View GitHub Profile
Debug output for Geocode::lookup
Geocode: 'Query' => 'New York'
'Structured query' => False
'Name keys' => 'short_name:en-US', 'name:en-US', 'short_name:en', 'name:en', 'short_name', 'name', 'brand', 'official_name:en-US', 'official_name:en', 'official_name', 'ref', 'type'
'Include address' => False
'Excluded place IDs' =>
'Try reversed query' => True
'Limit (for searches)' => 20
'Limit (for results)' => 10
'Country codes' =>
postgres=# \c nominatim;
You are now connected to database "nominatim" as user "postgres".
nominatim=# \di
List of relations
Schema | Name | Type | Owne
r | Table
--------+-------------------------------------------------------+-------+-------
----+---------------------------
public | idx_country_name_country_code | index | nomina
tim | country_name
# ..in general,
require 'rails'
require File.expand_path("../config/application.rb", __FILE__)
Rails.application.initialize!
# fork fork fork
ENV['UNICORN_WORKERS'].times do
fork do
# child
# -*- encoding: binary -*-
# This is the process manager of Unicorn. This manages worker
# processes which in turn handle the I/O and application process.
# Listener sockets are started in the master process and shared with
# forked worker children.
#
# Users do not need to know the internals of this class, but reading the
# {source}[https://bogomips.org/unicorn.git/tree/lib/unicorn/http_server.rb]
# is education for programmers wishing to learn how unicorn works.
module ConcurrentExecutor
class Error < StandardError
def initialize(exceptions)
@exceptions = exceptions
super
end
def message
@exceptions.map { | e | e.message }.join "\n"
end
# from_cte_sql = ::Namespace::From.where_clause
# ..
from_table = Arel::Table.new(:from_lane)
to_table = Arel::Table.new(:to_lane)
rates_table = Arel::Table.new(:rates)
rates_table
.join(from_table).on(rates_table[:from_id].eq(from_table[:id]))
#!/bin/bash
set -e
if ! grep -q xenial /etc/lsb-release
then
echo "Adding PPA for up-to-date Node.js runtime. Give your password when asked."
# sudo add-apt-repository ppa:chris-lea/node.js
sudo add-apt-repository ppa:chris-lea/redis-server
else
SELECT DISTINCT(each_attribute ->> 'reference_number_field')
AS reference_number
FROM deliveries
CROSS JOIN json_array_elements(reference_numbers)
AS each_attribute
WHERE (each_attribute -> 'reference_number_field')
IS NOT NULL
@midhunkrishna
midhunkrishna / resume.md
Created January 7, 2016 05:58
Resume problem

The resume problem

  • Write program which read following details from termial
    • Name
    • Age
    • Qualification
  • Write these details to a text file

Notes:

  • Use KISS principle
@midhunkrishna
midhunkrishna / ceaser_cipher.md
Last active January 4, 2016 12:03
Caeser Cipher

Caeser Cipher

  • Read about Caeser Cipher
  • Program should read from file and convert the entire text data, no need to convert special character
  • The program should write to a file

Points

  • Should be object oriented

  • Program should be designed rather than written

  • Finish on or before 9PM today