Skip to content

Instantly share code, notes, and snippets.

View qqpann's full-sized avatar
🍊

Qiushi Pan qqpann

🍊
View GitHub Profile
@qqpann
qqpann / index.md
Created November 4, 2018 16:44
[Awesome Front end] #awesome #front #frontend #front-end #icon

Awesome front end

This awesome list is incomplete, as I am not actively collecting these links, but passively adding what I read.

Icons

  • eva-icons Available as WebFont and also SVG. Also supports animation.
@qqpann
qqpann / index.md
Created November 4, 2018 15:20
[Save html with Wget] #cli #command-line #wget
@qqpann
qqpann / readme.md
Last active October 31, 2018 10:46
[MongoDB quickstart] MongoDB quickstart guide #mongodb #nosql
@qqpann
qqpann / readme.md
Created October 14, 2018 09:34
[Pandas Rolling] 窓関数. 時系列データ処理など #pandas #rolling #window #窓関数 #時系列データ
@qqpann
qqpann / base.html
Last active October 7, 2018 15:32
[Ajax Quickstart] Ajax quickstart template #ajax
<!-- thanks: https://qiita.com/zakiyamaaaaa/items/bdda422db2ccbaea60d9 -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<button id="ajax">ajax</button>
<div class="result"></div>
<script type="text/javascript">
$(function(){
// Ajax button click
$('#ajax').on('click',function(){
@qqpann
qqpann / index.md
Created September 29, 2018 16:34
[SSH limit access by IP] Allow ssh access from only desired ip. #SSH #IP
PasswordAuthentication no
PubkeyAuthentication no

Then add desired authentication methods after a Match Address in the end of the file. Placing Match in the end of the file is important, since all the configuration lines after it are placed inside the conditional block until the next Match line. For example:

Match Address 127.0.0.*
 PubkeyAuthentication yes
@qqpann
qqpann / progressbar.py
Created September 18, 2018 17:20
[Python Progress Bar] Python Progress Bar #python #progressbar
import sys
import time
toolbar_width = 40
# setup toolbar
sys.stdout.write("[%s]" % (" " * toolbar_width))
sys.stdout.flush()
# return to start of line, after '['
sys.stdout.write("\b" * (toolbar_width + 1))
@qqpann
qqpann / quickstart.py
Created September 18, 2018 14:25
[Python Click ~ cli library] Python cli library: Click #python #click #cli
import click
@click.command()
@click.option('--count', default=1, help='Number of greetings.')
@click.option('--name', prompt='Your name',
help='The person to greet.')
def hello(count, name):
"""Simple program that greets NAME for a total of COUNT times."""
for x in range(count):
click.echo('Hello %s!' % name)
@qqpann
qqpann / middleware.py
Created September 11, 2018 07:22 — forked from daniestrella1/middleware.py
Django middleware to log the total number of queries run and query time for every request
from django.db import connection
import logging
logger = logging.getLogger(__name__)
class QueryCountDebugMiddleware(object):
"""
This middleware will log the number of queries run
and the total time taken for each request (with a
status code of 200). It does not currently support
@qqpann
qqpann / list_in_dict.py
Created September 2, 2018 11:19
[Python list as dict value] Best practice to use list as dict value #python #dict #list
dic = dict()
key, value = 'some key', 'some value'
dic[key] = dic.get(key, []) + [value]
dic.setdefault(key,[]).append(value)
# doesn't work:
# dic[key] = dic.get(key, []).append(value)
# https://docs.python.org/3/library/stdtypes.html#dict.setdefault