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
-- get functions | |
SELECT 'DROP FUNCTION IF EXISTS ' || ROUTINE_NAME || ' CASCADE;' | |
FROM information_schema.routines | |
WHERE routine_type = 'FUNCTION' | |
AND specific_schema = 'public' | |
AND ROUTINE_NAME IN ('ichux') | |
UNION | |
-- get triggers | |
SELECT 'DROP TRIGGER IF EXISTS ' || TRIGGER_NAME || ' ON ' || event_object_table || ';' | |
FROM information_schema.triggers |
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
SELECT routine_name FROM information_schema.routines | |
WHERE routine_type='FUNCTION' AND specific_schema='public' ORDER BY routine_name |
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
WITH first_day AS (SELECT date_trunc('MONTH', NOW()) :: DATE), | |
last_day AS (SELECT (date_trunc('MONTH', (SELECT * FROM first_day)) + INTERVAL '1 MONTH' - | |
INTERVAL '1 DAY') :: DATE) | |
SELECT first_day.*, last_day.* | |
FROM first_day, | |
last_day; |
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
SELECT month_day1 :: DATE AS month_starts, | |
(month_day1 + INTERVAL '1 month' - INTERVAL '1 day') :: DATE AS month_ends, | |
(month_day1 + INTERVAL '1 month') :: DATE AS next_month_starts, | |
(month_day1 + INTERVAL '1 month') :: DATE - month_day1 :: DATE AS days | |
FROM generate_series(DATE '2018-01-01', DATE '2018-12-01', INTERVAL '1 month') AS month_day1; |
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
WITH first_day AS (SELECT date_trunc('MONTH', NOW()) :: DATE AS first_date), | |
last_day AS (SELECT (date_trunc('MONTH', (SELECT * FROM first_day)) + INTERVAL '1 MONTH' - | |
INTERVAL '1 DAY') :: DATE AS last_date) | |
SELECT row_to_json(first_last) | |
FROM (SELECT first_day.*, last_day.* | |
FROM first_day, | |
last_day) first_last; |
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
stat -f "%Lp" ~/Downloads/Visual_Debugging.mp4 | |
chmod 644 from step 1 | |
find . -iname '*.mp4' -type f -exec chmod 644 {} \; |
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 email.utils | |
import smtplib | |
from email.mime.text import MIMEText | |
# Create the message | |
msg = MIMEText('Hello SMTPD!') | |
msg['To'] = email.utils.formataddr(("Local Mail", "localmail@localhost")) | |
msg['From'] = email.utils.formataddr(('Chukwudi Nwachukwu', 'chukwudinwachukwu@localhost')) | |
msg['Subject'] = 'Local mail using SMTP' |
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 flask import Flask, render_template, request, redirect, url_for | |
from werkzeug import secure_filename | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
return render_template('index.html') |
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
let interates = document.querySelectorAll('div[id^=epom-]'); | |
for (let count = 0; count < interates.length; count++) { | |
interates[count].innerHTML=''; | |
} |
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 re | |
text = "This is a whole new chapter in this coding skill set. And I do hope if turns out well" | |
breakdown = {} | |
for word in re.sub('\W', ' ', text).split(): | |
breakdown[word] = breakdown.get(word, 0) + 1 |