Skip to content

Instantly share code, notes, and snippets.

View daviddwlee84's full-sized avatar
💭
Just wanna be happier

David Lee daviddwlee84

💭
Just wanna be happier
View GitHub Profile
@schaumb
schaumb / redirect.py
Last active February 4, 2025 12:20
streamlit redirect
import streamlit as st
import io
import contextlib
import sys
import re
import threading
class _Redirect:
class IOStuff(io.StringIO):
@alxtz
alxtz / bg-search.js
Last active March 30, 2022 05:43
其實不是什麼高深的東西,給大家複製來自己改,有語法問題可以問 twitch: alex_tzeng
!commands edit -cd=5 !亞服
$(eval
let api = $(urlfetch json https://playhearthstone.com/en-us/api/community/leaderboardsData?region=AP&leaderboardId=BG&seasonId=3);
let r = api.leaderboard.rows;
let q = "$(1)";
let rest = q.substring(1, q.length);
let f = q[0] === '#' ? r[parseInt(rest) - 1] : r.find(u => u.accountid.toUpperCase() === q.toUpperCase());
f === undefined ? `[$(user)]: ${q} 不在亞服排行榜,沒料` : `[$(user)]: ${f.accountid} 目前亞服 #${f.rank},${f.rating}分`;
)
@beaucarnes
beaucarnes / keep_alive.py
Created December 10, 2020 15:42
Python Server for Discord Bot
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():
@everttrollip
everttrollip / remove-git-lfs.md
Last active April 3, 2025 02:49
Removing git lfs from (any) repository

So, it has been an interesting journey, but time to remove git-lfs. Here follows a summary of the approach I used to safely remove git-lfs,

  • commit & push everything
  • create a branch, something like fix/remove-lfs
  • remove hooks git lfs uninstall
  • remove lfs stuff from .gitattributes (open file, delete content - don't delete the file!)
  • list all lfs files, git lfs ls-files
  • run git rm --cached for each file
    • if your list is big, copy the contents into a file.txt
  • make sure you remove the number and asterik on each line, you only want the paths to the files
@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active May 14, 2025 07:39
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

Pip is a package manager of python. You can download Python libraries from some Python repositories like PyPI. You can also download libraries from a git repository. This is gonna be the issue to be explained in this article.

I don't like to memorize things all the time. So, I guess, I couldn't be working without internet :). Whenever I need to install some python libraries from a git repositories, I see a lot of way to do it. It is really confusing. This should be the reason why I can't memorize it. I can see how a very simple requirement is handled with to many confusing way. There shouldn't be to many way. Some of them is not working neither. At last, I decided to blog it.

As you may know, you can use two protocols which are http and ssh to do something on git repositories. Using protocol ssh instead of http may provide some ease of use. Because of nature of ssh, you can do something with your primary/public keys. So, you don't have to input your credentials all the time. But I'll be

port: 7890
socks-port: 7891
redir-port: 7892
allow-lan: true
mode: Rule
log-level: info
external-controller: 0.0.0.0:9090
secret: "xxxxxx"
dns:
enable: true
@markopy
markopy / streamlit_command_line.py
Created October 22, 2019 16:23
How to parse command line arguments in streamlit with argparse
# An Example of how to parse command line arguments in streamlit.
# This is free and unencumbered software released into the public domain.
import os
import sys
import random
import argparse
import streamlit as st
parser = argparse.ArgumentParser(description='This app lists animals')
@mrnabati
mrnabati / gitSolutions.md
Last active December 27, 2024 00:28
Common Git problems (and solutions!)

Working with submodules in your repository

  • Create the submodule:

    git submodule add -b master <[email protected]:MYSUBMODULE.git> <path/to/MYSUBMODULE>

    This creates the submodule and makes it track submodule's master branch. You can change the branch name if you want to track a different branch.

  • Change some settings. In the parent repo:

    # make it so that git status will include changes to submodules.
@tvst
tvst / SessionState.py
Last active September 30, 2024 07:47
DO NOT USE!!! Try st.session_state instead.
"""Hack to add per-session state to Streamlit.
Usage
-----
>>> import SessionState
>>>
>>> session_state = SessionState.get(user_name='', favorite_color='black')
>>> session_state.user_name
''