Skip to content

Instantly share code, notes, and snippets.

@period331
period331 / test.py
Created July 17, 2020 06:09
命令行布局管理器 Python命令行下多行刷新
# -*- coding:utf8 -*-
import time,sys
def progressbar():
print 'Loading...'
print "[+] start to build...."
height = 4
for i in range(0, 100):
if i > 0:
sys.stdout.write(u'\u001b[1A')
time.sleep(0.1)
""" An example of a Linux daemon written in Python.
Based on http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
The changes are:
1 - Uses file open context managers instead of calls to file().
2 - Forces stdin to /dev/null. stdout and stderr go to log files.
3 - Uses print instead of sys.stdout.write prior to pointing stdout to the log file.
4 - Omits try/excepts if they only wrap one error message w/ another.
@period331
period331 / fpm.d目录下的www.conf
Last active April 25, 2016 04:27
nginx-php开发环境配置
;;;;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
; 只关注需要修改的配置;
;;;;;;;;;;;;;;;;;;;;;;;
; 以登陆用户的用户名和分组,避免权限问题
user = baocaixiong
group = staff
; The address on which to accept FastCGI requests.
@period331
period331 / esnextbin.md
Last active April 22, 2016 03:57
esnextbin sketch

原文

警告:请务必读完本文!全篇读完!

无论新老用户,都有可能掉进陷阱。 下面我们列出了常见的问题,并解释如何解决他们。 在 Freenode IRC 的 #nginx 频道,我们经常看到这些问题。

[TOC]

@period331
period331 / nginx.sh
Created December 29, 2013 15:29 — forked from marshluca/nginx.sh
# /etc/init.d/nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
from multiprocessing import Process
import os
import time
import setproctitle
setproctitle.setproctitle('subprocess')
def targ(x):
setproctitle.setproctitle('subprocess_' + str(x))
print '这是一个进程任务' + str(os.getpid())
@period331
period331 / proc.py
Created December 11, 2013 09:51
python subProcess problem
# coding: utf8
from multiprocessing import Process
import os
import time
import setproctitle
setproctitle.setproctitle('subprocess')
def targ(x):
@period331
period331 / EqualTest.m
Created December 9, 2014 15:09
== and isEqual Objective-C
#import <Foundation/Foundation.h>
int main(int argc, char * argv[])
{
@autoreleasepool {
NSString * str1 = @"hello";
NSString * str2 = [NSString stringWithFormat:@"hello"];
NSLog(@"str1 == str2 ??; %d", (str1 == str2)); // 输出 0
#import <Foundation/Foundation.h>
@interface FKFruit : NSObject
@property(nonatomic, assign) double weight;
@property(nonatomic, assign) int a;
-(void) info;
@end