Skip to content

Instantly share code, notes, and snippets.

View Ashwinning's full-sized avatar

Ashwin Sinha Ashwinning

View GitHub Profile
@Ashwinning
Ashwinning / draw_text_with_background_opencv.py
Last active May 30, 2019 19:46 — forked from aplz/draw_text_with_background_opencv.py
draw text with background // opencv
import cv2
class DrawText:
def __init__(self, img, text, font_scale = 1, posX = 10, posY = 10, font = cv2.FONT_HERSHEY_PLAIN, bgColor = (255, 255, 255), textColor = (0, 0, 0), fontThickness = 1, padding = 2):
self.font_scale = font_scale
self.font = font
rectangle_bgr = bgColor
# set some text
self.text = text
# get the width and height of the text box
@Ashwinning
Ashwinning / example.md
Created December 2, 2018 09:25
How to resize all images in a folder as a percentage using imagemagick

With image magick installed:

  • Create a new folder for the output images
  • cd to your path where the original images are stored
  • Run
mogrify -path <PATH TO OUTPUT FOLDER> -format png -resize 25%x25% *.png
import json

Flipkart's Sachin Bansal, Ola's Bhavish Aggarwal seek government's help in battle against Amazon & Uber

Reposted because http://economictimes.indiatimes.com/ does not play well with genius.it

economictimes.indiatimes.com · By Madhav Chanchani

BENGALURU: India’s most successful internet entrepreneurs –Flipkart’s
<html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:valurl="com.times.utilities.CMSWebUtility" xmlns:nohtml="com.til.utils.CommonUtils" xmlns:listval="com.indiatimes.cms.utilities.CMSDateUtility" xmlns:java="java" xmlns:g="http://base.google.com/ns/1.0" itemtype="http://schema.org/Article"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><title>Flipkart's Sachin Bansal, Ola's Bhavish Aggarwal seek government's help in battle against Amazon &amp; Uber - The Economic Times</title><link rel="image_src" href="http://img.etimg.com/thumb/msid-55862068,width-672,resizemode-4,imglength-63158/small-biz/startups/flipkarts-sachin-bansal-olas-bhavish-aggarwal-seek-governments-help-in-battle-against-foreign-rivals.jpg"><meta http-equiv="Last-Modified" content="9 Dec,2016 2142hrs IST"><meta name="description" content="They have now raised the banner of nationalism, urging the government to design policies which will favour desi cos against foreign rivals."><meta name="news_k
@Ashwinning
Ashwinning / __YoutubeMp3DownloadAndSplit.md
Last active July 21, 2023 15:25
Python Youtube MP3 Splitter #gistblog #python

Python Youtube MP3 Splitter

A Python program that splits mp3 files from YouTube albums into individual songs.

Dependencies

  • Python 2.7+
  • ffmpeg

Getting Started

@Ashwinning
Ashwinning / Gist-Wordpress-Sync.md
Last active November 16, 2016 12:20
Gist - Wordpress Sync #gistblog

Gist - Wordpress Sync

This is a tale of how this very section - hacks.ash.wine works.

I ❤️ Gists, and I have a habit of posting small stuff/code/discoveries/guides etc. up there so I can revisit them later. (All of my public gists : https://gist.github.com/Ashwinning)

Additionally I use Gistbox, which allows me to categorize/add labels to my gists and find search through them faster.

@Ashwinning
Ashwinning / Top-5-Electoral-Power-By-Voter-Eligibility.md
Created November 14, 2016 10:31
Top 5 States : Electoral Power By Voter Eligibility

| State | Electoral-Votes | Voting-Eligible-Population | Eligible-Voters-Per-Elector | Weight-By-Eligibility | | --- | --- | --- | --- | --- | --- | | Wyoming | 3 | 431,011 | 143670.3333 | 293.67% | | Vermont | 3 | 496,439 | 165479.6667 | 254.97% | | District of Columbia | 3 | 516,771 | 172257 | 244.93% | | Alaska | 3 | 519,501 | 173167 | 243.65% | | North Dakota | 3 | 582,534 | 194178 | 217.28% |

@Ashwinning
Ashwinning / Bottom-5-Electoral-Power-By-Voter-Eligibility.md
Created November 14, 2016 10:30
Bottom 5 States : Electoral Power By Voter Eligibility

| State | Electoral-Votes | Voting-Eligible-Population | Eligible-Voters-Per-Elector | Weight-By-Eligibility | | --- | --- | --- | --- | --- | --- | | Florida | 29 | 14,601,373 | 503495.6207 | 83.80% | | North Carolina | 15 | 7,317,507 | 487833.8 | 86.49% | | Pennsylvania | 20 | 9,737,690 | 486884.5 | 86.66% | | Ohio | 18 | 8,753,269 | 486292.7222 | 86.76% | | New York | 29 | 13,693,128 | 472176.8276 | 89.36% |

| State | Electoral-Votes | Estimated-Ballots-Cast-In-2016 | Voters-Per-Elector | Weight | | --- | --- | --- | --- | --- | --- | | Florida | 29 | 9,500,000 | 327586.2069 | 76.02% | | North Carolina | 15 | 4,725,000 | 315000 | 79.06% | | Ohio | 18 | 5,650,000 | 313888.8889 | 79.34% | | Virginia | 13 | 3,965,000 | 305000 | 81.65% | | Michigan | 16 | 4,800,000 | 300000 | 83.01% |