Skip to content

Instantly share code, notes, and snippets.

View Mark24Code's full-sized avatar
💻
Exploring

Mark24 Mark24Code

💻
Exploring
View GitHub Profile
@natritmeyer
natritmeyer / debug_httparty_request.rb
Last active May 24, 2024 20:46
How to debug HTTParty requests
class MyResource
include HTTParty
debug_output $stdout # <= will spit out all request details to the console
#...
end
@jcouyang
jcouyang / 2012-12-31-node-dot-js-vs-tornado-vs-php.markdown
Last active January 15, 2021 02:38
为什么事件驱动服务器这么火

本文基本上这为两篇文章的翻译和整合 -- Scalable networking And Why are event-driven server so great

OPPC模型瓶颈

传统服务器模型如Apache为每一个请求生成一个子进程。当用户连接到服务器的一个子进程就产生,并处理连接。每个连接获得一个单独的线程和子进程。当用户请求数据返回时,子进程开始等待数据库操作返回。如果此时另一个用户也请求返回数据,这时就产生了阻塞。

这种模式在非常小的工作负荷是表现良好,当请求的数量变得太大是服务器会压力过于巨大。 当Apache达到进程的最大数量,所有进程都变得缓慢。每个请求都有自己的线程,如果服务代码使用PHP编写时,每个进程所需要的内存量是相当大的[1]。

fork()操作延时

Specs

  • Mini PC + Arduino = pcDuino
  • OS: Lubuntu 和 Android 4.0 ICS
  • 本地输出: HDMI
  • 硬件接口与Arduino兼容

Details

  • 支持通过任何I/O接口来连接Arduino的盾板(shield), 允许使用在Arduino中一样的代码.
  • 出厂默认系统安装Ubuntu在NAND flash上. Ubuntu可以从NAND flash或者一个可以启动的microSD卡上启动.
@semenko
semenko / dmidecode
Last active October 26, 2021 02:57
Dell XPS 13 2015 model 9343 on Ubuntu 15.04, dmidecode, lsusb, lspci
$ sudo dmidecode
# dmidecode 2.12
# SMBIOS entry point at 0x000f0000
SMBIOS 2.8 present.
<SNIP>
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
@zaccrites
zaccrites / app.py
Last active February 16, 2023 04:57
Flask Application Factory
import jinja2
from flask import Flask, render_template, request, redirect, url_for
from flask.ext.sqlalchemy import SQLAlchemy
from . import formatting
from .config import get_config
db = SQLAlchemy()
@fuyufjh
fuyufjh / cheatsheet.py
Last active July 24, 2024 15:03
My Python Cheatsheet
Python Cheatsheet
=================
################################ Input & Output ###############################
name = input('please enter your name: ')
print('hello,', name)
ageStr = input('please enter your age: ')
age = int(ageStr)
@fooling
fooling / code line
Last active October 24, 2018 10:13
统计两次commit之间的代码量
git log --numstat --pretty="%H" 881579dd2569369f92104737d913629d4d6a6db5..branch_3.0.1 | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d,-%d\n",plus,minus)}'
git log --numstat --pretty="%H" 434868bb^..HEAD | grep bks | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
@matthewjberger
matthewjberger / instructions.md
Last active November 2, 2024 23:55
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache