Skip to content

Instantly share code, notes, and snippets.

View caimaoy's full-sized avatar

Yue Chen caimaoy

View GitHub Profile
@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active May 4, 2024 18: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.

@gaearon
gaearon / modern_js.md
Last active April 18, 2024 15:01
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@nileshk
nileshk / app.conf
Created February 2, 2018 02:48
supervisord config for Django + pyenv + pyenv-virtualenv + gunicorn
[program:_appname_]
command = /home/_username_/.pyenv/versions/venvname/bin/gunicorn -w 1 -b 127.0.0.1:8000 --pythonpath=. --reload wsgi:application
directory=/home/_username_/sites/_appname_/
environment=PATH="/home/_username_/.pyenv/versions/venvname/bin:/home/_username_/.pyenv/shims:/home/_username_/.pyenv/bin:",DJANGO_SETTINGS_MODULE="_appname_.settings",HOME="/home/_username_"
user=_username_
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
stderr_logfile=/home/_username_/log/_appname_-stderr.log
async def main():
coroutine1 = do_some_work(1)
coroutine2 = do_some_work(2)
coroutine3 = do_some_work(4)
tasks = [
asyncio.ensure_future(coroutine1),
asyncio.ensure_future(coroutine2),
asyncio.ensure_future(coroutine3)
]
@jorben
jorben / openssl_tool.txt
Last active August 6, 2018 02:06
RSA加解密,签名、验签文件
1) Generate RSA key:
$ openssl genrsa -out key.pem 1024
$ openssl rsa -in key.pem -text -noout
2) Save public key in pub.pem file:
$ openssl rsa -in key.pem -pubout -out pub.pem
$ openssl rsa -in pub.pem -pubin -text -noout
3) Encrypt some data:
@Integralist
Integralist / Python Asyncio Timing Decorator.py
Last active March 17, 2024 10:02
Python Asyncio Timing Decorator
import asyncio
import time
def timeit(func):
async def process(func, *args, **params):
if asyncio.iscoroutinefunction(func):
print('this function is a coroutine: {}'.format(func.__name__))
return await func(*args, **params)
else:
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@justinbellamy
justinbellamy / cltools.sh
Last active March 6, 2022 03:46 — forked from jellybeansoup/cltools.sh
Install Autoconf and Automake on OS X El Capitan
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@betrcode
betrcode / README.md
Created June 24, 2014 06:36
Using Python to check if remote port is open and accessible.