Skip to content

Instantly share code, notes, and snippets.

View yijxiang's full-sized avatar
🏠
Working from home

yijun xiang yijxiang

🏠
Working from home
View GitHub Profile
from fastapi import Security, Depends, FastAPI, HTTPException
from fastapi.security.api_key import APIKeyQuery, APIKeyCookie, APIKeyHeader, APIKey
from fastapi.openapi.docs import get_swagger_ui_html
from fastapi.openapi.utils import get_openapi
from starlette.status import HTTP_403_FORBIDDEN
from starlette.responses import RedirectResponse, JSONResponse
API_KEY = "1234567asdfgh"
API_KEY_NAME = "access_token"
@yijxiang
yijxiang / concurrent.kafka.consumer.py
Created November 5, 2020 05:36 — forked from pvsune/concurrent.kafka.consumer.py
A multiprocess multithreaded Kafka consumer
#!/usr/bin/env python
import logging
import os
import threading
import time
from multiprocessing import Process
from queue import Queue
from confluent_kafka import Consumer
@yijxiang
yijxiang / git-clearHistory
Created October 26, 2020 13:25 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@yijxiang
yijxiang / Visualize Git Cheatsheet.md
Created October 26, 2020 12:52 — forked from berkedel/Visualize Git Cheatsheet.md
Visualize Git Cheatsheet

Visualize Git Cheatsheet

Git Cheatsheet, (c) 2009-2012, Andrew Peterson

Stash

A place to hide modifications made to the workspace, while working on something else. (The stash area is not required in a “normal” workflow.)

Stash

@yijxiang
yijxiang / 10-cisco-elasticsearch.conf
Created August 2, 2020 01:37 — forked from justincjahn/10-cisco-elasticsearch.conf
Logstash: Processing Cisco Logs
#
# INPUT - Logstash listens on port 8514 for these logs.
#
input {
udp {
port => "8514"
type => "syslog-cisco"
}
@yijxiang
yijxiang / bigdashboard_output.pdf
Created June 4, 2020 07:31 — forked from svet-b/bigdashboard_output.pdf
PDF export of Grafana dashboard using puppeteer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yijxiang
yijxiang / bigdashboard_output.pdf
Created June 4, 2020 07:31 — forked from svet-b/bigdashboard_output.pdf
PDF export of Grafana dashboard using puppeteer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yijxiang
yijxiang / redis_cheatsheet.bash
Created January 19, 2020 08:53 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@yijxiang
yijxiang / redis_cheatsheet.bash
Created January 19, 2020 08:53 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@yijxiang
yijxiang / mac-setup-redis.md
Created January 15, 2020 03:08 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis