Skip to content

Instantly share code, notes, and snippets.

View darkcl's full-sized avatar

darkcl darkcl

  • Hong Kong
View GitHub Profile
gem install snapshot; snapshot reset_simulators
@darkcl
darkcl / example.m
Last active March 16, 2016 16:37
AFNetworking example
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:@"https://maps.googleapis.com"]];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
NSDictionary *param = @{@"address": @"str"};
[manager GET:@"/maps/api/geocode/json"
parameters:param
success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
// Map your model objects with responseObject
crontab -e
0 10 * * * rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport
crontab -l
@darkcl
darkcl / default.custom.yaml
Created August 12, 2016 14:20 — forked from lotem/default.custom.yaml
在Rime輸入方案選單中添加五筆、雙拼、粵拼、注音,保留你需要的
# default.custom.yaml
# save it to:
# ~/.config/ibus/rime (linux)
# ~/Library/Rime (macos)
# %APPDATA%\Rime (windows)
patch:
schema_list:
- schema: luna_pinyin # 朙月拼音
- schema: luna_pinyin_simp # 朙月拼音 简化字模式
@darkcl
darkcl / gist:0e3844f759cdea1ce8c83f4edeba6775
Created March 9, 2018 05:49 — forked from adamgit/gist:3705459
Automatically create cross-platform (simulator + device) static libraries for Objective C / iPhone / iPad
##########################################
#
# c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4
#
# Version 2.82
#
# Latest Change:
# - MORE tweaks to get the iOS 10+ and 9- working
# - Support iOS 10+
# - Corrected typo for iOS 1-10+ (thanks @stuikomma)
server {
listen 80;
access_log /var/log/nginx/api.log;
error_log /var/log/nginx/api_error.log;
server_name localhost;
location ^~ / {
proxy_pass http://api_one;
}
location ^~ /v2 {
FROM node:8
MAINTAINER Yeung Yiu Hung <[email protected]>
# Install ClamAV and supervisord
# Debian Base to use
ENV DEBIAN_VERSION jessie
# Install ClamAV and supervisor
RUN echo "deb http://http.debian.net/debian/ $DEBIAN_VERSION main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://http.debian.net/debian/ $DEBIAN_VERSION-updates main contrib non-free" >> /etc/apt/sources.list && \
[supervisord]
nodaemon=true
[program:clamd]
directory=/
command=clamd &
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisor/%(program_name)s.log
import express from "express";
import multer = require("multer");
import * as stream from "stream";
import clamav from "clamav.js";
var upload = multer({
storage: multer.memoryStorage()
});
@darkcl
darkcl / Makefile
Created September 10, 2018 10:16
MongoDB Replica Set
MONGO_SCRIPT := $(shell cat ./rs_config)
start-mongo-rs:
@echo "Starting MongoDB Replica Set (localhost:30001)"
@docker-compose -f ./mongo_rs/docker-compose.yml up -d
@echo Wait...
@sleep 15
@docker exec -it mongo_master mongo --eval "$(MONGO_SCRIPT)"
@docker exec -it mongo_master mongo --eval "rs.status()"