This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HBASE Database Design Here : https://github.com/jerinisready/Kafka-Twittter-Streaming | |
from __future__ import print_function | |
import json | |
import happybase | |
# from happybase import connection as Connection | |
## START bin/hbase rest start -p <port> | |
## VARS | |
LISTENING_TOPIC = 'myWorld' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A: | |
KEY = 'u5NeFqa------------tZ2UM' | |
SECRET = 'WgWtW3tL_--------------------------IlKD5GTHCfTjrLBsrC' | |
TOKEN = '1495931731-r----------------------------kjpfcMAjXxk' | |
TOKEN_SECRET = 'Im24KQ------------------------------fMJyK' | |
api_keys = A() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
QUESTION | |
Let 'a' be the list of users who likes a post! I want to get displayed as below | |
eg 1 :- a = [] | |
Output : Nobody likes This | |
eg 2 :- a = ['Alice'] | |
Output : Alice likes This |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# VIEW INDEXES applied on database. | |
select schemaname, tablename, indexname, indexdef from pg_indexes WHERE schemaname='public'; | |
# Create superuser for postgres on linux shell with postgres user. | |
user@ubuntu$ sudo su postgres | |
user@ubuntu$ createuser --interactive --pwprompt root | |
> Enter password for new role: ******** | |
> Enter it again: ******** | |
> Shall the new role be a superuser? (y/n) y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import load_iris | |
from sklearn import tree | |
import numpy as np | |
import csv | |
# | |
# TODO : This Commented code will run with dataset predefined in sklearn.datasets | |
# | |
# iris = load_iris() | |
# # print (iris.feature_names ) | |
# # print (iris.target_names) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sin, cos, radians, acos | |
def calculate_distance(lat_a, long_a, lat_b, long_b, in_miles=True): | |
"""all angles in degrees, default result in miles""" | |
lat_a = radians(lat_a) | |
lat_b = radians(lat_b) | |
delta_long = radians(long_a - long_b) | |
cos_x = ( | |
sin(lat_a) * sin(lat_b) + | |
cos(lat_a) * cos(lat_b) * cos(delta_long) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This Demonize a Traffic Signal Control sample HTML PAGE using Pure JS | |
Preview is available on : https://bl.ocks.org/jerinisready/raw/8e15bcab2fe048b317119ea174576ef1/ | |
Description is avbailable on : https://bl.ocks.org/jerinisready/8e15bcab2fe048b317119ea174576ef1#file-traffic_light-html | |
PREVIEW PARTNERSHIP WITH : https://bl.ocks.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function set_custom_error_message(data) { | |
var elements= $(data[0]); | |
var message = data[1]; | |
for (var i = 0; i < elements.length; i++) { | |
var my_element = elements[i]; | |
my_element.oninvalid = function(e) { | |
e.target.setCustomValidity(""); | |
if (!e.target.validity.valid) { | |
e.target.setCustomValidity(message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Showing {{ page_obj.start_index }} to {{ page_obj.end_index }} of {{ page_obj.paginator.count }} entries | |
{% if is_paginated %} | |
<ul class="pagination"> | |
<!-- VERY FIRST --> | |
<li class="first {% if page_obj.number == 1 %} disabled {% endif %} " | |
id="m_table_1_first"> | |
<a href="?page=1"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.encoding import filepath_to_uri | |
from storages.backends.s3boto3 import S3Boto3Storage | |
class CustomStorage(S3Boto3Storage): | |
def path(self, name): | |
return filepath_to_uri(name) | |
OlderNewer