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
// This is the companion code for the linked blog | |
// https://blog.kmonsoor.com/on-edge-shortlink-server-cloudflare-kv-worker | |
// Please check the blog to get the context | |
// author : Khaled Monsoor (@kmonsoor) | |
// last updated: 25-May-2021 | |
const failsafeURL = "https://kmonsoor.com" // replace it with yours ;) | |
const defaultStatusCode = 301 // standard HTTP code for redirection, don't change | |
addEventListener("fetch", (event) => { |
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
# replce server address with actual Jira host for your case | |
options = {'server': 'https://jira.atlassian.com'} | |
#login | |
jira = JIRA(options, basic_auth=(os.environ['JIRA_USERNAME'], os.environ['JIRA_PASSWORD'])) | |
#get currently available version names | |
project = jira.project('PROJECT-KEY') | |
versions = jira.project_versions(project) | |
current_versions = [v.name for v in reversed(versions)] |
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
"use strict"; | |
// src: https://stackoverflow.com/a/28002292 | |
const getScript = (source, callback) => { | |
var script = document.createElement('script'); | |
var prior = document.getElementsByTagName('script')[0]; | |
script.async = 1; | |
script.onload = script.onreadystatechange = (_, isAbort) => { | |
if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) { |
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
"use strict"; | |
(() => { | |
var console = (window.console = window.console || {}); | |
[ | |
"assert", "clear", "count", "debug", "dir", "dirxml", | |
"error", "exception", "group", "groupCollapsed", "groupEnd", | |
"info", "log", "markTimeline", "profile", "profileEnd", "table", | |
"time", "timeEnd", "timeStamp", "trace", "warn" | |
].forEach(method => { | |
console[method] = () => {}; |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
#************************************************************************** | |
# Copyright (C) 2011, Paul Lutus * | |
# * | |
# This program is free software; you can redistribute it and/or modify * | |
# it under the terms of the GNU General Public License as published by * | |
# the Free Software Foundation; either version 2 of the License, or * | |
# (at your option) any later version. * |
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
// $ node | |
// > process.version; | |
// 'v8.9.4' | |
// > http.STATUS_CODES | |
{ '100': 'Continue', | |
'101': 'Switching Protocols', | |
'102': 'Processing', | |
'200': 'OK', | |
'201': 'Created', |
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 current date in PST time-zone | |
SELECT DATE_ADD(DATE(CONVERT_TZ(current_time(), 'GMT', 'US/Pacific')); |
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 os | |
import glob | |
import exifread | |
NAME_LENGTH = 10 | |
jpg_files = glob.glob('*.jpg') | |
for a_file in jpg_files: | |
try: |
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
# src: https://stackoverflow.com/a/12424439/617185 | |
def send_email(user, password, recipient, subject, body): | |
import smtplib | |
FROM = user | |
TO = recipient if type(recipient) is list else [recipient] | |
SUBJECT = subject | |
TEXT = body |
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 the above custom my.cnf, add this at the Dockerfile | |
FROM mysql:latest | |
COPY ./custom-mysql.cnf /etc/mysql/conf.d/ | |
NewerOlder