Skip to content

Instantly share code, notes, and snippets.

View tao12345666333's full-sized avatar
🎯
Focusing

Jintao Zhang tao12345666333

🎯
Focusing
View GitHub Profile
@lyshie
lyshie / gitbook-to-rpm.md
Last active July 17, 2018 07:00
Convert GitBook from deb to rpm (tested on Fedora 26/27)

Convert deb to rpm

$ sudo alien -r --keep-version gitbook-editor-7.0.12-linux-x64.deb
$ rpmrebuild -pe gitbook-editor-7.0.12-1.x86_64.rpm

Delete unnecessary lines in rpm spec

Requires:      libnode.so()(64bit)
Requires:      libffmpeg.so()(64bit)
@tianon
tianon / put-multiarch-prototype.sh
Last active May 11, 2019 14:40
The original Bash-based prototype for https://github.com/docker-library/official-images/pull/5897 to prove out the concept \m/
#!/usr/bin/env bash
set -Eeuo pipefail
# for real pushes, this would be "library"
targetOrg='trollin'
# https://github.com/tianon/dockerhub-public-proxy
publicProxy="$DOCKERHUB_PUBLIC_PROXY"
_curl() {
@kejun
kejun / gist:3f4851c7f3b3e209fcbb
Last active July 9, 2019 15:23
最近一次项目的总结

mathclub是最近做的一个个人项目,帮助考SAT的同学通过在线做题、回顾、问答提高成绩。用户功能有:计次/计时做题、成绩单、错题分布、错题回顾、提问、汇总以及注册登录。管理后台主要是题库管理、学员管理、成绩单管理、问题回复。怎么看都像学校里的课设,的确项目本身并不出奇,开发上选用的一些方案或许更有意思。

整个项目一个人从产品需求、原型设计、前后端开发到部署历时2周左右。可以从截图上感受一下:

image

技术选型上服务端是Node.js,应用框架选了老牌的Express(4.x变化挺大不少中间件都废了),数据服务用的是MongoLab(MongoDB的云服务平台),图片上传用的是又拍云,程序部署在Nodejitsu上。模板引擎没选主流的Jade或ejs,而是用Express React Views它实现了在服务端渲染React组件。前端框架是用React,这次有意想追求前后端全部组件化的组织。之前是用Webpack实现CommonJS模块打包,这次用Browserify配置更简单,它有丰富的transform很赞,其中的reactify转换React的JSX很完美。CSS用Sass+autoprefixer让人省心。将这一切串起来的自动构建工具是Gulp。我其实崇尚用最精简的工具组合开发,上述组合在我看来比较精简了。(帖纸留念)

![image](http://satexam.b0.upaiyu

@lbolla
lbolla / README.md
Created October 3, 2012 10:05
Asynchronous programming in Tornado

Asynchronous programming with Tornado

Asynchronous programming can be tricky for beginners, therefore I think it's useful to iron some basic concepts to avoid common pitfalls.

For an explanation about generic asynchronous programming, I recommend you one of the [many][2] [resources][3] [online][4].

I will focus on solely on asynchronous programming in [Tornado][1]. From Tornado's homepage:

@kracekumar
kracekumar / ws_app.py
Last active October 5, 2021 08:52
Simple websocket server with uvloop.
# -*- coding: utf-8 -*-
import asyncio
import uvloop
from aiohttp.web import Application, MsgType, WebSocketResponse
def add_socket(app, socket, user_id):
if user_id in app['connections']:
pass
# This gist is compatible with Ansible 1.x .
# For Ansible 2.x , please check out:
# - https://gist.github.com/dmsimard/cd706de198c85a8255f6
# - https://github.com/n0ts/ansible-human_log
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@obscurerichard
obscurerichard / redis-scan.sh
Last active March 13, 2023 09:17 — forked from itamarhaber/scan_del.sh
A bash script that scans Redis keys by pattern using SCAN
#!/usr/bin/env bash
# redis-scan.sh
#
# Adapted by @obscurerichard from itamarhaber/scan_del.sh:
# https://gist.github.com/itamarhaber/11126830
#
# Thanks @czerasz and @tenlee2012 for fixes
#
# Usage:
# ./redis-scan.sh localhost 6378 0 '*test*'
@rothgar
rothgar / install-tmux
Last active April 5, 2023 06:53 — forked from ekiara/how_to_install_tmux_on_centos
Install tmux 1.9 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
@phpdude
phpdude / nginx.conf
Last active February 28, 2024 04:36
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@tazjin
tazjin / thoughts.md
Last active February 28, 2024 12:05
Nix builder for Kubernetes