Skip to content

Instantly share code, notes, and snippets.

View vvaezian's full-sized avatar

Vahid Vaezian vvaezian

View GitHub Profile
@vvaezian
vvaezian / Country Names with Abbreviations.csv
Last active November 18, 2022 12:57
Country names together with their ISO 3166-1 alpha-2 codes
Andorra AD
United Arab Emirates AE
Afghanistan AF
Antigua and Barbuda AG
Anguilla AI
Albania AL
Armenia AM
Angola AO
Antarctica AQ
Argentina AR
hashtag_list = ['travelblog', 'travelblogger', 'traveler']
# prev_user_list = [] - if it's the first time you run it, use this line and comment the two below
prev_user_list = pd.read_csv('20181203-224633_users_followed_list.csv', delimiter=',').iloc[:,1:2] # useful to build a user log
prev_user_list = list(prev_user_list['0'])
new_followed = []
tag = -1
followed = 0
likes = 0
import psycopg2
connection = psycopg2.connect(user="USER"
, password="PASSWORD"
, port="5432"
, database="DB_NAME"
, host="HOST")
cursor = connection.cursor()
with open('ratings.tsv') as f:
f.readline()
select a.id, title_type,
case when title_type in ('movie', 'tvMovie') then 'Movie'
when title_type in ('tvSeries', 'tvMiniSeries') then 'Series'
end as item_type,
original_title, primary_title, start_year, runtime_minutes,
genres, avg_rating, num_votes
into movies_series
from source_basics a join source_ratings b on a.id = b.id
where title_type in ('movie', 'tvMovie', 'tvSeries', 'tvMiniSeries');
@vvaezian
vvaezian / imdb_create_cards.sql
Last active November 22, 2020 21:46
imdb_create_cards.sql
-- Seasons Rating (AVG)
select "Season", avg("Rating") "Rating Average"
from episodes
where 1 = 1
[[ and {{primary_title}} ]]
[[ and "# Votes" > {{num_votes}} ]]
group by "Season"
-- Episodes Rating
select
-- GENRES (Helper Table)
create table genres (
genre varchar(20)
);
insert into genres
values ('Action'),('Adventure'),('Animation'),('Biography'),('Comedy'),('Crime'),('Drama')
,('Family'),('Fantasy'),('Film-Noir'),('History'),('Horror'),('Music'),('Musical')
,('Mystery'),('Romance'),('Sci-Fi'),('Sport'),('Thriller'),('War'),('Western')
@vvaezian
vvaezian / nationality_countryName.csv
Last active June 26, 2021 19:00
Nationality and Country Name
Afghan Afghanistan
Albanian Albania
Algerian Algeria
Argentine Argentina
Argentinianan Argentina
Australian Australia
Austrian Austria
Bangladeshi Bangladesh
Belgian Belgium
Bolivian Bolivia
'continent' 'country'
'South America' 'Argentina'
'South America' 'Bolivia'
'South America' 'Brazil'
'South America' 'Chile'
'South America' 'Colombia'
'South America' 'Ecuador'
'South America' 'Guyana'
'South America' 'Paraguay'
'South America' 'Peru'
Warning: environ value jdk-11.0.12+7 for key :java-version has been overwritten with 11.0.12
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-11-03 04:38:57,677 INFO metabase.util :: Maximum memory available to JVM: 481.4 MB
2021-11-03 04:39:13,917 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. 🔓
For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
2021-11-03 04:39:19,378 INFO driver.impl :: Registered abstract driver :sql 🚚
↙ Load driver :sql took 921.5 ms
2021-11-03 04:39:19,399 INFO driver.impl :: Registered abstract driver :sql-jdbc (parents: [:sql]) 🚚
Load driver :sql-jdbc took 958.2 ms
2021-11-03 04:39:19,410 INFO driver.impl :: Registered driver :h2 (parents: [:sql-jdbc]) 🚚
Warning: environ value jdk-11.0.11+9 for key :java-version has been overwritten with 11.0.11
2021-11-03 05:00:36,948 INFO metabase.util :: Maximum memory available to JVM: 481.4 MB
2021-11-03 05:00:52,347 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. 🔓
For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
2021-11-03 05:01:01,377 INFO metabase.core ::
Metabase v0.40.0 (961caed master)
Copyright © 2021 Metabase, Inc.
Metabase Enterprise Edition extensions are NOT PRESENT.