Skip to content

Instantly share code, notes, and snippets.

@amrrs
amrrs / article-spell-checker.py
Created June 5, 2017 17:05
Article Spell-Checker in Python
import newspaper
from nltk import word_tokenize
import enchant
import re
url = 'https://hackernoon.com/dilemmas-of-a-digital-lifestyle-27c044940157' #input URL
my_article = newspaper.Article(url,language='en') # ### Extracting the Article Content
my_article.download()
my_article.parse()
d = enchant.Dict("en_US") # ### Spell-Checking the tokenized words
print(list(set([word.encode('ascii', 'ignore') for word in word_tokenize(my_article.text) if d.check(word) is False and re.match('^[a-zA-Z ]*$',word)] )))
@amrrs
amrrs / crptocurrency_marketcap_share.r
Created October 9, 2017 11:03
Draw a Tree Map of Cryptocurrency Marketcap share
library(coinmarketcapr)
library(treemap)
df <- get_marketcap_ticker_all()
df1 <- na.omit(df[,c('id','market_cap_usd')])
df1$market_cap_usd <- as.numeric(df1$market_cap_usd)
@amrrs
amrrs / find_emoji.r
Created October 27, 2017 12:06 — forked from hrbrmstr/find_emoji.r
find and extract emoji in R
# save this to '_chat.txt` (it require a login)
# https://www.kaggle.com/sarthaknautiyal/whatsappsample
library(ore)
library(dplyr)
emoji_src <- "https://raw.githubusercontent.com/laurenancona/twimoji/gh-pages/twitterEmojiProject/emoticon_conversion_noGraphic.csv"
emoji_fil <- basename(emoji_src)
if (!file.exists(emoji_fil)) download.file(emoji_src, emoji_fil)
@amrrs
amrrs / app.r
Created November 21, 2017 08:04
How to upload and embed pdf in R shiny (iframe)
library(shiny)
ui <- shinyUI(fluidPage(
titlePanel("Testing File upload"),
sidebarLayout(
sidebarPanel(
fileInput('file_input', 'upload file ( . pdf format only)', accept = c('.pdf'))
),

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@amrrs
amrrs / coindeskr_last31_btc.R
Created January 8, 2018 10:01
Visualizing Bitcoin Movement Last 31 days
library(coindeskr) #R-Package connecting to Coindesk API
library(ggplot2)
library(ggthemes)
#Extracting Bitcoin USD Price for the last 31 days
last31 <- get_last31days_price()
date <- rownames(last31)
@amrrs
amrrs / plotly-docs.R
Created March 5, 2018 09:08 — forked from cpsievert/plotly-docs.R
Plotly examples
# install the new/experimental plotly R package
# devtools::install_github("ropensci/plotly@carson-dsl")
# ----------------------------------------------------------------------
# https://plot.ly/r/3d-line-plots/
# ----------------------------------------------------------------------
library(plotly)
# initiate a 100 x 3 matrix filled with zeros
#!/bin/bash
TODAY=`date +%Y-%m-%d`
TODAY_MD=`date +%B\ %d,\ %Y`
YEAR=`date +%Y`
PACKAGENAME=$1
##
## CHANGE ME!!!
@amrrs
amrrs / hinton.py
Created May 27, 2019 11:51 — forked from wtznc/hinton.py
Web scrapper for Geoffrey Hinton's publications, +- 250MB
# download this file
# install bs4, re, urllib
# run python3 hinton.py
from urllib import request
import re
import os
from bs4 import BeautifulSoup
def main():
curdir = os.getcwd()
@amrrs
amrrs / gist:9ce2461c56f1d2cad4d2b16e3d1c646a
Last active July 19, 2019 00:42 — forked from bessarabov/gist:674ea13c77fc8128f24b5e3f53b7f094
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'