Skip to content

Instantly share code, notes, and snippets.

@j0e1in
j0e1in / copy_sqs.py
Last active August 2, 2020 17:47
Copy AWS SQS queue messages to another queue.
from tqdm import trange
import argparse
import boto3
parser = argparse.ArgumentParser(description="Migrate messages from SQS queues.")
parser.add_argument('--src', required=True, help='Name of the source queue.')
parser.add_argument('--dst', required=True, help='Name of the destination queue.')
parser.add_argument('--batches', help='Number of batches to process', default=1, type=int)
parser.add_argument('--batch-size', help='Number of messages in a batch', default=10, type=int)
args = parser.parse_args()
@j0e1in
j0e1in / download_tidal_favorite_artists.py
Created June 27, 2020 20:06
Download all albums/tracks of all of your favorite artists on TIDAL.
""" Download all albums/tracks of all of your favorite artists on TIDAL.
# Usage
- Install dependency: `pip install -U tidal-dl`
- Create tidal-dl.ini with following content and then fill your username and password
```
username = <username>
password = <password>
@j0e1in
j0e1in / cloudSettings
Last active May 25, 2021 00:08
Visual Studio Code Settings Sync Gist For Mac
{"lastUpload":"2021-05-25T00:08:16.901Z","extensionVersion":"v3.4.3"}
@j0e1in
j0e1in / Mongodb_Letsencrypt.md
Last active April 10, 2024 13:16
Setup mongodb TSL/SSL with letsencrypt.

Setup Mongo 3.6 TSL/SSL with Letsencrypt

Install certbot

sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot
@j0e1in
j0e1in / run_async_in_thread.py
Last active April 21, 2018 19:45
Run an async function / coroutine in a thread.
##########################################################
# Use cases
# 1. Start an async function in __init__
# 2. Start an endless (while loop) async function while current event loop is running
# 3. ...
#
# Limitations
# 1. Some libraries (eg. motor) cannot be executed using this method, because you can't control how event loop is retrieved. (See another method below)
#
# Usage:
@j0e1in
j0e1in / sanic-run.py
Created March 11, 2018 16:07 — forked from wonderbeyond/sanic-run.py
A sanic entry-script for development (supports auo-reload, shell-mode)
import argparse
from app import app
def main():
parser = argparse.ArgumentParser(
description='Sanic test server',
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
@j0e1in
j0e1in / XPS-15 9560 Getting Nvidia To Work on KDE Neon
Created August 12, 2017 03:36 — forked from whizzzkid/XPS-15 9560 Getting Nvidia To Work on KDE Neon
Making Nvidia Drivers + CUDA 8 + Bumblebee work together on XPS 15 Early 2017 9560 kabylake. Ubuntu, KDE Neon, Linux Mint, debian.
# As of writing this, 4.11 kernel fails, 4.10.15 fails, 4.11rc8 seems to be working. Apply the graphics patches first.
# Install Intel Graphics Patch Firmwares (This should reboot your system):
bash -c "$(curl -fsSL http://bit.ly/IGFWL-install)"
# Update to 4.11.2 kernel. nvidia-375 compiles fine >=4.11.1
cd /tmp
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.2/linux-headers-4.11.2-041102_4.11.2-041102.201705201036_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.2/linux-headers-4.11.2-041102-generic_4.11.2-041102.201705201036_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.11.2/linux-image-4.11.2-041102-generic_4.11.2-041102.201705201036_amd64.deb
program_NAME := myprogram
program_C_SRCS := $(wildcard *.c)
program_CXX_SRCS := $(wildcard *.cpp)
program_C_OBJS := ${program_C_SRCS:.c=.o}
program_CXX_OBJS := ${program_CXX_SRCS:.cpp=.o}
program_OBJS := $(program_C_OBJS) $(program_CXX_OBJS)
program_INCLUDE_DIRS :=
program_LIBRARY_DIRS :=
program_LIBRARIES :=