Skip to content

Instantly share code, notes, and snippets.

View dfmcvn's full-sized avatar
💭
kek

Dang Minh Duc dfmcvn

💭
kek
  • Hanoi, Vietnam
View GitHub Profile
@dfmcvn
dfmcvn / purge_redis_expired.py
Created August 24, 2018 11:10
Python script: delete all Redis keys older than 6 hours
# pip install redis
# python purge_redis_expired.py
#!/usr/bin/env python
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0)
for key in r.scan_iter("*"):
idle = r.object("idletime", key)
# idle time is in seconds. This is 6h
if idle > 21600:
@dfmcvn
dfmcvn / nginxproxy.md
Created February 18, 2018 05:28 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers