Skip to content

Instantly share code, notes, and snippets.

View southpolemonkey's full-sized avatar
🎯
Focusing

southpolemonkey

🎯
Focusing
View GitHub Profile
@bradtraversy
bradtraversy / node_redis_cache.js
Created August 20, 2019 12:55
Node.js & Redis Caching
const express = require('express');
const fetch = require('node-fetch');
const redis = require('redis');
const PORT = process.env.PORT || 5000;
const REDIS_PORT = process.env.PORT || 6379;
const client = redis.createClient(REDIS_PORT);
const app = express();
@dasgoll
dasgoll / gist:2f27ec2b703fbcb49a273d550d7865f8
Created January 31, 2019 09:50
Python send smtp email outlook
https://medium.freecodecamp.org/send-emails-using-code-4fcea9df63f
# import the smtplib module. It should be included in Python by default
import smtplib
# set up the SMTP server
s = smtplib.SMTP(host='smtp-mail.outlook.com', port=587)
s.starttls()
s.login('[email protected]', 'password')
===
import smtplib
@Ardagan
Ardagan / .gitconfig
Last active June 27, 2024 20:43
.gitconfig
[remote "origin"]
url = [email protected]:Ardagan/beam.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "upstream"]
url = [email protected]:apache/beam.git
fetch = +refs/heads/master:refs/remotes/upstream/master
fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*
fetch = +refs/pull/*/merge:refs/remotes/upstream/pull/*
@mnguyenngo
mnguyenngo / zscore.py
Last active August 1, 2024 19:58
Code to calculate and plot the z-score
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as scs
def z_val(sig_level=0.05, two_tailed=True):
"""Returns the z value for a given significance level"""
z_dist = scs.norm()
if two_tailed:
sig_level = sig_level/2
area = 1 - sig_level
@bradtraversy
bradtraversy / docker-help.md
Last active November 15, 2024 17:06
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@i-like-bikes
i-like-bikes / lga_year.py
Created April 26, 2018 14:46
LGA and year filtering
import datetime
import logging
import sys
from mongoengine import connect
from mongoengine import DateTimeField, Document, EmbeddedDocument, EmbeddedDocumentField, IntField, ListField, StringField
from pymongo.errors import OperationFailure
# Solution comes from following this:
# https://stackoverflow.com/questions/28982285/mongodb-projection-of-nested-arrays
@adamhaney
adamhaney / dag.py
Created June 14, 2017 18:10
DBT Airflow DAG with model/graph introspection
from datetime import datetime, timedelta
import networkx as nx
from airflow import DAG
from airflow.operators import BashOperator, SubDagOperator
start_date = datetime(year=2017, month=6, day=13, hour=19, minute=0)
schedule_interval = '0 * * * 1-5'
default_args = {
@tao12345666333
tao12345666333 / Regex-match-Chinese.py
Created July 23, 2014 15:03
正则表达式匹配中文
import re
nickname = raw_input('Please input your nickname > ')
if not re.search(u'^[\u4e00-\u9fa5a-zA-Z0-9]+$', unicode(nickname,'utf8')):
print 'Your nickname format is error, please try again !'
else:
print 'Hello %s'% nickname
@billygoat
billygoat / atom.html
Created April 21, 2013 11:53
Jinja2 template for an Atom feed.
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ SITENAME }}</title>
<link rel="alternate" type="text/html" href="{{ FEED_DOMAIN }}" />
<link rel="self" type="application/atom+xml" href="{{ FEED_DOMAIN }}/feeds/atom.xml" />
<id>{{ FEED_DOMAIN }}/</id>
{% if articles %}
{% for article in articles %}
{% if loop.first %}
<updated>{{ article.date_utc.strftime('%Y-%m-%dT%H:%I:%SZ') }}</updated>
@digitaljhelms
digitaljhelms / gist:4287848
Last active November 19, 2024 18:20
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch