Skip to content

Instantly share code, notes, and snippets.

View hondajojo's full-sized avatar
🏠
Working from home

maijver hondajojo

🏠
Working from home
View GitHub Profile
@rushilgupta
rushilgupta / GoConcurrency.md
Last active July 11, 2024 12:52
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@cloverstd
cloverstd / main.py
Created October 22, 2016 09:31
Handle file upload by Tornado and Nginx Upload Module
#!/usr/bin/env python
# encoding: utf-8
import tornado.ioloop
import tornado.web
import tornado.log
import tornado.httpserver
from tornado.options import define, options
import logging
import tornado.gen
@ethan-funny
ethan-funny / flask-rest-server.py
Created August 17, 2016 03:57
flask restful api
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, abort, make_response
from flask import request
app = Flask(__name__)
articles = [
{
'id': 1,
@soffchen
soffchen / surge.conf
Last active March 4, 2024 05:23
surge.conf
[General]
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
loglevel = notify
[Proxy]
BJ-All = custom
BJ-HK-Azure = custom
BJ-US-Azure = custom
@evi1m0
evi1m0 / PicConverText.py
Last active December 5, 2023 03:08
12306 新版验证码识别脚本 (已失效)
#!/usr/bin/env python
# coding=utf8
# author=evi1m0
# website=linux.im
'''
12306 Captcha Picture:
author: Evi1m0@20150316
1. Download Captcha
2. Pic Conver Text
@arthuralvim
arthuralvim / kill_spiders.sh
Created September 24, 2014 17:28
Scrapy - Kill all spiders
ps aux | grep "scrapy crawl" | grep -v grep | awk "{ print \$2 }" | xargs kill -9
@PeterDing
PeterDing / pan.baidu.com.py
Last active March 31, 2018 13:31
百度云、百度网盘,递归下载自己的文件或分享的文件 -- keywords: pan.baidu.com, login, recursively, download -- # 移到仓库 https://github.com/PeterDing/iScript
#!/usr/bin/env python2
# vim: set fileencoding=utf8
import os
import sys
import requests
import urllib
import json
import re
import time
@bkdinoop
bkdinoop / login-example
Last active May 21, 2024 06:25
Flask-Login : login.py created by https://github.com/maxcountryman : Matthew Frazier
# -*- coding: utf-8 -*-
"""
Flask-Login example
===================
This is a small application that provides a trivial demonstration of
Flask-Login, including remember me functionality.
:copyright: (C) 2011 by Matthew Frazier.
:license: MIT/X11, see LICENSE for more details.
"""
@mogsdad
mogsdad / digest.js
Last active October 29, 2021 03:28
This Google Apps Script function returns a string representing the 16-byte MD5 digest of a given message. It was originally written as an answer to StackOverflow question http://stackoverflow.com/questions/16216868/get-back-a-string-representation-from-computedigestalgorithm-value-byte. It's been refactored to support adaptation to other digest …
/**
* Return string representation of MD5 digest of the given message.
*
* @param {String} message Message to be encoded.
*
* @return {String} 16-byte digest value
*/
function signMd5(message){
return digest(Utilities.DigestAlgorithm.MD5, message);
}
@doobeh
doobeh / example.html
Last active April 19, 2022 10:25 — forked from anonymous/siecje.py
Simple example of using a RadioField in Flask-WTForms to generate a form.
<form method="post">
{{ form.hidden_tag() }}
{{ form.example }}
<input type="submit">
</form>