Skip to content

Instantly share code, notes, and snippets.

View ratulotron's full-sized avatar
🎯

Ratul Minhaz ratulotron

🎯
View GitHub Profile
@Jarmos-san
Jarmos-san / main.py
Last active June 10, 2024 14:32
A simple FastAPI project with a health check route
"""Entrypoint to invoke the FastAPI application service with."""
from fastapi import FastAPI, status
from pydantic import BaseModel
import uvicorn
app = FastAPI()
class HealthCheck(BaseModel):
@msumit
msumit / redis_xcom.py
Created December 4, 2020 08:35
Apache Airflow CustomXCom Backend for Redis
# This is an example to show how easy to extend the custom XCom backends in Apache Airflow.
# File: airflow/providers/redis/xcom/redis_xcom.py
# Author: Sumit Maheshwari
import json
import logging
from typing import Any
import uuid
from airflow.configuration import conf
@andrebrait
andrebrait / keychron_linux.md
Last active June 16, 2024 19:44
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

window:
dynamic_padding: true
decorations: none
startup_mode: Fullscreen
font:
normal:
family: Source Code Pro
style: SemiBold
bold:
family: Source Code Pro
@samuelralak
samuelralak / solution.ex
Last active March 25, 2023 20:29
HackerRank 30 days of code. Day 0: Hello, World. Read from STDIN in Elixir
defmodule Solution do
#Enter your code here. Read input from STDIN. Print output to STDOUT
def read do
case IO.read(:stdio, :line) do
:eof -> :ok
{:error, reason} -> IO.puts "Error: #{reason}"
data ->
IO.write(:stdio, "Hello, World. \n")
IO.write(:stdio, data)
read()
@ck3g
ck3g / example.ex
Created February 14, 2019 16:14
How to read from STDIN in Elixir (for HackerRank)
defmodule Solution do
#Enter your code here. Read input from STDIN. Print output to STDOUT
end
array_length = IO.read(:stdio, :line)
array = IO.read(:stdio, :line)
array_length
|> String.trim
|> String.to_integer
@bogaotory
bogaotory / install_bionic_on_x1c6.md
Last active May 15, 2024 03:25
Install Ubuntu 18.04 on Thinkpad X1 Carbon 6th Generation

Install Ubuntu 18.04 on Thinkpad X1 Carbon 6th Gen/2018

X1C6 Type: 20KG*

Bionic works out of the box on the new 2018 X1 Carbon. The X1C6 is a beautiful laptop, and Bionic is the best Ubuntu yet. Users of all levels of experties/experiences are recommended to try this combination. The purpose of this documentation is to improve the user's experience.

BIOS/UEFI Changes

Following changes are required by the DSDT patch:

  1. Turn off Secure Boot
@ganapativs
ganapativs / iTerm2 + oh-my-zsh + Pure theme + zsh plugins setup.md
Last active May 26, 2024 19:11
iTerm2 + oh-my-zsh + Pure theme + zsh plugins setup
@wronk
wronk / python_environment_setup.md
Last active May 14, 2024 21:10
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview of Python Virtual Environments

This guide is targetted at intermediate or expert users who want low-level control over their Python environments.

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. This helps keep each workflow in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. The guide here covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda). See the Using the workflow section to view the end result.


h/t @sharkinsspatial for linking me to the perfect cartoon

@grimzy
grimzy / git-pull-all
Created September 15, 2017 02:15
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all