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
CREATE TABLE IF NOT EXISTS `country` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`iso` char(2) NOT NULL, | |
`name` varchar(80) NOT NULL, | |
`nicename` varchar(80) NOT NULL, | |
`iso3` char(3) DEFAULT NULL, | |
`numcode` smallint(6) DEFAULT NULL, | |
`phonecode` int(5) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
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 IPython.display import display, HTML | |
display(HTML(data=""" | |
<style> | |
div#notebook-container { width: 95%; } | |
div#menubar-container { width: 65%; } | |
div#maintoolbar-container { width: 99%; } | |
</style> | |
""")) |
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
-- Heavily inspired by this StackOverflow thread | |
-- https://stackoverflow.com/questions/47230534/how-do-i-create-a-dates-table-in-redshift | |
-- and tired of bumping my head in the wall after getting the generate_series() error. | |
DROP VIEW IF EXISTS public.dim_date; | |
CREATE VIEW public.dim_date AS | |
WITH | |
digit AS ( | |
SELECT | |
0 AS D |
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
-- Retrieved from http://dev.mysql.com/doc/refman/5.6/en/string-functions.html at 2015-feb-10 18:16 | |
-- Working on MySQL version 5.6.19-0ubuntu0.14.04.1 (Ubuntu) | |
-- | |
-- Posted by Chris Stubben on August 21 2008 3:49pm | |
-- Split delimited strings | |
CREATE FUNCTION | |
strSplit(x VARCHAR(255), delim VARCHAR(12), pos INT) RETURNS VARCHAR(255) | |
return | |
REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos), |
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 s3fs.core import S3FileSystem | |
s3 = S3FileSystem(anon=False, profile_name="your-profile-name") | |
print(s3.ls("s3://your-bucket/some-folder")) |
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
-- Found at http://stackoverflow.com/a/17922821/597349 | |
DROP TABLE IF EXISTS urlcodemap; | |
CREATE TABLE `urlcodemap` ( | |
`id` INT(11) NOT NULL AUTO_INCREMENT, | |
`encoded` VARCHAR(128) NOT NULL, | |
`decoded` VARCHAR(128) NOT NULL, | |
UNIQUE KEY urlcodemapUIdx1(encoded), | |
PRIMARY KEY (`id`) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import pandas as pd | |
pd.set_option("display.max_rows", 200) | |
pd.set_option("display.max_columns", 100) | |
pd.set_option("display.max_colwidth", 200) | |
## Reset to defaults | |
# pd.reset_option("^display") |
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
# After Ubuntu 16.04, Systemd becomes the default. | |
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd | |
# https://gist.github.com/whophil/5a2eab328d2f8c16bb31c9ceaf23164f | |
# PUT THIS IN /usr/lib/systemd/system | |
[Unit] | |
Description=Jupyter Notebook | |
[Service] | |
Type=simple |
NewerOlder