Skip to content

Instantly share code, notes, and snippets.

@caojianhua
caojianhua / SimpleHTTPServerWithUpload.py
Created April 3, 2020 01:54 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@caojianhua
caojianhua / rename.sh
Last active August 29, 2022 07:36
Rename file to create date from exif info
#! /usr/bin/env bash
dir=$1
if [ -z "$dir" ]; then
echo "输入参数有误!"
exit
else
echo "正在处理$dir"
fi
@PeitongWang
PeitongWang / gist:9e8de1fb514906f1b2e9caad4791f5cc
Last active August 17, 2022 15:42
Mac自带Apache Web服务器基本使用
想着如何在Mac OS下部署静态网页(纯粹的html,css,js),用惯了windows下的iis,可惜Mac OS下也许只能通过Tomcat或者Apache之类的作为部署容器。听说Mac OS下自带了apache,于是就折腾起来。
环境:macbook air os x 10.9.5
找到apache藏身之所
系统默认是隐藏apache安装目录的,但我们可以通过“命令行”或者“文件夹前往”的方式找到它。它是安装在系统的私有目录下,也就是/private/etc下面,因为它是隐藏的,所以我们无法通过界面找到它。
ps:/ect目录是mac os 系统存放系统配置信息的地方,里面都是xxx.conf的配置文件。
命令行
在终端输入 open /etc 命令即可打开它的“住所”了。请看:
终端调用apache
文件夹前往
打开Finder > 前往 >前往文件夹。请看:
#!/usr/bin/env xcrun swift -F Carthage/Build/Mac
import Foundation
import Markingbird
protocol Streamable {
var title: String { get }
var body: String { get }
}
@ityancs
ityancs / TextViewVertical.java
Created September 25, 2015 07:14
A vertical TextView like Chinese old text style
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.FontMetrics;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;

Live Transcoding

This is a collection of working commandline examples to show how one could use FFMpeg and VLC for live transcoding of video streams. All examples have been tested on OSX 10.7.5 with FFMPeg 1.1.3 and VLC 2.0.5 in early 2013.

Documentation links

Live Transcoding

This is a collection of working commandline examples to show how one could use FFMpeg and VLC for live transcoding of video streams. All examples have been tested on OSX 10.7.5 with FFMPeg 1.1.3 and VLC 2.0.5 in early 2013.

Documentation links

@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active March 10, 2024 19:23
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active April 23, 2024 02:53
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S