Skip to content

Instantly share code, notes, and snippets.

Avatar
💾
JUST DO GIT.

Mahbub Zaman lifeparticle

💾
JUST DO GIT.
View GitHub Profile
View medium_24.py
import os
import re
import sys
import json
import tweepy
import requests
def twitter_authentication():
auth = tweepy.OAuthHandler(os.environ['CONSUMER_KEY'], os.environ['CONSUMER_SECRET'])
auth.set_access_token(os.environ['ACCESS_TOKEN'], os.environ['ACCESS_TOKEN_SECRET'])
View medium_22_1.py
from PIL import Image
import pytesseract
def process_image(iamge_name, lang_code):
return pytesseract.image_to_string(Image.open(iamge_name), lang=lang_code)
def print_data(data):
print(data)
def output_file(filename, data):
View medium_21_6.java
public static int countOccurrences(int values[], int target) {
return upperBound(values, target) - lowerBound(values, target);
}
View medium_21_5.java
public static int lowerBound (int values[], int target) {
int left = 0;
int right = values.length - 1;
int mid;
if (values[right] < target)
return values.length;
while (right > left){
mid = (left + right) / 2;
View medium_21_4.java
public static int upperBound (int values[], int target) {
int left = 0;
int right = values.length - 1;
int mid;
if (values[right] <= target)
return values.length;
while (right > left){
mid = (left + right) / 2;
View medium_21_3.java
public static int lastOccurrence (int values[], int target) {
int left = 0;
int mid = 0;
int right = values.length - 1;
int pos = -1;
while (left <= right) {
mid = (left + right) / 2;
if (target == values[mid]) {
View medium_21_2.java
public static int firstOccurrence (int values[], int target) {
int left = 0;
int mid = 0;
int right = values.length - 1;
int pos = -1;
while (left <= right) {
mid = (left + right) / 2;
if (target == values[mid]) {
View medium_21_1.java
public static int binarySearch (int values[], int target) {
int left = 0;
int mid = 0;
int right = values.length - 1;
while (left <= right) {
mid = (left + right) / 2;
if (target == values[mid])
return mid;
View v2.json
{
"title": "An Introduction to Ruby Hashes",
"url": "https://towardsdatascience.com/an-introduction-to-ruby-hash-1c1c4b2dd905"
}
vs.
{
"title": "An Introduction to Ruby Hashes",
"link": "https://towardsdatascience.com/an-introduction-to-ruby-hash-1c1c4b2dd905",
View bot_v2_js.js
posts = []
Array.prototype.forEach.call(document.getElementsByClassName("nd rk rd x"), function(post) {
postObj = {};
postObj.title = post.getElementsByTagName("a")[0].innerText;
postObj.link = post.getElementsByTagName("a")[0].href;
postObj.pubDate = post.getElementsByClassName("dv")[1].innerText;
posts.unshift(postObj);
});