Skip to content

Instantly share code, notes, and snippets.

View qykong's full-sized avatar
🐢

Quyu Kong qykong

🐢
View GitHub Profile
@shivaalroy
shivaalroy / openai_usage_tool.py
Last active April 30, 2024 02:52
Get OpenAI Usage / Spend information programmatically, broken down by API key, model, input and output
import argparse
from datetime import date, timedelta
from typing import TypedDict
import requests
from tabulate import tabulate
class OpenAiUsageTool:
'''
@coltoneshaw
coltoneshaw / upgrade.sh
Last active May 15, 2021 08:11
Upgrade script for Mattermost Docker Install
#!/bin/bash
# Credit for helping to outline the correct upgrade process goes to @tuxity and @GuidoDr
##
## Instructions
##
# 1. Edit the variables below to match your environment. This uses default variables and assumes you're on 5.31.0.
# If you're wanting to use another version of Postgres/Mattermost , update the variables as desired.
@sequoiap
sequoiap / get_docker.sh
Last active February 16, 2021 06:25
Install docker on Ubuntu
#!/usr/bin/env bash
# Convenience script for setting up docker and docker-compose on Ubuntu.
# Steps essentially copied and pasted from:
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
# https://docs.docker.com/compose/install/
# Uninstall any existing docker installations
sudo apt-get remove docker docker-engine docker.io containerd runc
@gwangjinkim
gwangjinkim / install-and-start-postgresql-in-conda-locally
Last active June 10, 2024 05:01
How to install and run postgresql in conda
This gist I write, because I couldn't find step by step instructions
how to install and start postgresql locally (using conda within a conda environment - with the result
that you can run it without sudo/admin rights on your machine!)
and not globally in the operating system (which requires sudo/admin rights on that machine).
I hope, this will help especially people new to postgresql (and those who don't have sudo/admin rights on a specific machine but want
to run postgresql there)!
####################################
# create conda environment
@wonzbak
wonzbak / vimrc.minimal
Created March 6, 2017 15:13
Vim minimal config file
set shell=/bin/sh " fish friendly
"
" Base configuration from https://github.com/tpope/vim-sensible
"
if has('autocmd')
filetype plugin indent on
endif
if has('syntax') && !exists('g:syntax_on')
syntax enable
endif
@garrettdashnelson
garrettdashnelson / bib-titlecase.py
Last active April 25, 2024 13:35
Convert titles in bibtex citation library to title case
# Original by Daniel L. Greenwald
# http://dlgreenwald.weebly.com/blog/capitalizing-titles-in-bibtex
# Modified by Garrett Dash Nelson
import re
from titlecase import titlecase
# Input and output files
my_file = 'library.bibtex'
new_file = 'library-capitalized.bibtex' # in case you don't want to overwrite
@jmorton
jmorton / Dockerfile
Last active March 27, 2019 08:31
Install Python 3.4.2 + mod_wsgi on CentOS
FROM centos:centos6
MAINTAINER jmorton@usgs.gov
# Apache
RUN yum install -y httpd httpd-devel
RUN chkconfig httpd on
RUN apachectl start
# Dependencies
RUN yum groupinstall -y "Development tools"