Skip to content

Instantly share code, notes, and snippets.

View muhakbaryasin's full-sized avatar

Muhammad Akbar Yasin muhakbaryasin

View GitHub Profile
@Artistan
Artistan / redis_cli_install_update.sh
Last active January 26, 2024 01:08
Install redis-cli on your other machines.
if [[ -d redis ]]
then
cd redis
git pull
else
git clone http://github.com/antirez/redis.git
cd redis && git checkout 4.0
fi
make redis-cli
@legnaleurc
legnaleurc / asyncio.py
Last active November 17, 2018 21:27
Tornado v.s. asyncio (Python 3.5+)
#! /usr/bin/env python3
import asyncio
import contextlib
async def ping(ip):
p = await asyncio.create_subprocess_exec('ping', '-c', '4', ip, stdout=asyncio.subprocess.PIPE)
async for line in p.stdout:
print(line)
@soheilhy
soheilhy / nginxproxy.md
Last active March 25, 2025 14:55
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

@uris77
uris77 / repo_pattern.py
Last active May 8, 2024 14:20
Example of Repository Pattern with SQLAlchemy
# This is a very crud example of using the Repository Pattern with SQLAlchemy. It allows me to completely ignore interactions with
# the database. This is only pulled in whenever I require to persist or retrieve an object from the database. The domain/business
# logic is entirely separated from persistence and I can have true unit tests for those.
# The tests for persistence are then limited to very specific cases of persistence and retrieving instances, and I can do those
# independent of the business logic. They also tend to be less tests since I only need to test them once.