Skip to content

Instantly share code, notes, and snippets.

View travishen's full-sized avatar
🎹
Play till the end.

ssivart travishen

🎹
Play till the end.
View GitHub Profile
@VKen
VKen / docker-start-celery-multi-worker-entrypoint
Created September 19, 2019 03:57
Running celery multi in docker container with running logs, signal trap, and graceful shutdown & restart
#!/bin/sh
# safety switch, exit script if there's error. Full command of shortcut `set -e`
set -o errexit
# safety switch, uninitialized variables will stop script. Full command of shortcut `set -u`
set -o nounset
# tear down function
teardown()
{
@fkztw
fkztw / korean_fish.py
Last active May 10, 2019 06:18
Yet another chatbot
#!/usr/bin/env python3
import itertools
whats = [
'自經區', '自貿區',
'摩天輪', '愛情摩天輪', '愛情產業鏈',
'發大財', '愛河的水甘甘', '選總統',
'迪士尼',
@travishen
travishen / fibonacci-python.ipynb
Last active July 14, 2019 10:40
Implement Fibonacci with loop, recursion, reduce
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lorisleiva
lorisleiva / GoogleApiAccess.md
Last active May 13, 2024 14:20
This gist describes two processes allowing us to access the Google API and to register some webhooks

Access Google API credentials and domain verification

This gist describes two processes allowing us to access the Google API and to register some webhooks. At the end of both processes we will obtain all variable needed to start using their API and we will have whitelisted all necessary URL to get started. We will be using the Google Calendar API and the Google Plus API to access the email address of the user.

This gist has been created as an Appendix to this article (part 1) and this article (part 3).

Note that, I will be using a randomly generated ngrok domain during this presentation. Simply replace b3093b51.ngrok.io with your domain name


@rhoboro
rhoboro / async_sample.py
Last active April 30, 2023 07:24
asyncio, aiohttpを利用した並列処理のサンプルコード
import asyncio
import aiohttp
import async_timeout
from aiohttp import ClientError
async def _fetch(session, url, coro):
"""HTTPリソースからデータを取得しコルーチンを呼び出す
@dleske
dleske / k8s-update-secret.md
Last active January 29, 2024 17:12
k8s: Updating a Secret

Hopefully helped another k8s newbie with the following. The question was, how do you update a single key in a secret in k8s? I don't know anything about secrets but I will probably want to know this in the future, so here we go.

First, to create a dummy secret:

apiVersion: v1
kind: Secret
metadata:
  name: test-secret
data:
@zparnold
zparnold / one_liner.sh
Last active October 23, 2024 20:28
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
@troyharvey
troyharvey / deployment.yml
Last active September 13, 2024 19:00
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@alistairewj
alistairewj / install-postgres-10-ubuntu.md
Last active October 3, 2024 00:19
Install PostgreSQL 10 on Ubuntu

Install PostgreSQL 10 on Ubuntu

This is a quick guide to install PostgreSQL 10 - tested on Ubuntu 16.04 but likely can be used for Ubuntu 14.04 and 17.04 as well, with one minor modification detailed below.

(Optional) Uninstall other versions of postgres

To make life simple, remove all other versions of Postgres. Obviously not required, but again, makes life simple. If you have data in your previous version of postgres that you'd like to retain, then this is not recommended. Instead, you'll have to use pg_upgrade or pg_upgradecluster.

@josephkern
josephkern / example_image_utils.py
Last active July 29, 2023 10:44 — forked from turicas/example_image_utils.py
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText