Skip to content

Instantly share code, notes, and snippets.

View kasuganosora's full-sized avatar
🙎‍♀️
Working at home

KasuganoSora kasuganosora

🙎‍♀️
Working at home
View GitHub Profile
@robertpitt
robertpitt / socks5.js
Created July 30, 2012 01:30
SOCKS5 Server as per rfc1928 (nodejs)
/**
* SOCKS5 Proxy as per RFC1928
* @see : http://www.ietf.org/rfc/rfc1928.txt
*/
/**
* Load Dependancies
*/
var net = require('net'),
@geekontheway
geekontheway / import_file_to_gridfs.rake
Created October 30, 2012 16:57 — forked from HungYuHei/import_file_to_gridfs.rake
将 File System 的上传文件导入到 Mongodb 的 GridFS 里面
# coding: UTF-8
#
# 以下为 Rake 任务,功能是将普通文件系统里面的东西转移到 MongoDB GridFS 里面
# 此代码片段来自于 Homeland 项目: https://github.com/huacnlee/homeland/tree/mysql
# 场景:
# 老架构 Linux File Store, Paperclip, hash 目录:"https://github.com/huacnlee/homeland/blob/ca0bdd8ab26da7b780e2dae7eba12b79f41e6d65/config/initializers/paperclip_hashpath.rb"
# 新架构 Mongodb GridFS, Garrierwave, 继续沿用 Paperclip 目录兼容: https://github.com/huacnlee/homeland/tree/7100ce4c506cc2c4387f25e50c533e5bbcac6cc2/app/uploaders
# 整个过程不会修改任何原始数据库和上传文件
#
require 'mongo'
@kavu
kavu / example.go
Created September 28, 2013 10:01
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];

在这篇笔记的最前面,我一定要说,网络协议的设计者都是天才

使用SMTP发送邮件其实十分简单,就如同我们和人交谈别无二致。这里我们使用SMTP协议发送一封邮件,小小体会一下网络协议之美。我在这里使用Windows平台上的VS2013 作为编码环境,使用C++,和WinSock中的socket函数通信。

什么是SMTP,用Python中的SMTP模块发送一封邮件

SMTP--Simple Mail Transfer Protocol,简单邮件传输协议。这是一个应用层协议,我们可以使用此协议,发送简单的邮件。SMTP基于TCP协议,在不使用SSL,TLS加密的SMTP协议中,我们默认使用端口号25,在使用SSL\TLS的SMTP协议中,使用端口号465\587。

一次传输邮件的过程,其实就是一次和服务器对话的过程。为了标识这些对话中的各种动作,我们需要使用语言来和服务器沟通。例如客户端发送给服务器一条信息EHLO(Hello),服务器就知道这个客户端要给我发邮件了,这类似于我们人与人之间打招呼,我和服务器说:我要发邮件了!!!,于是服务器知道我要发邮件了,会给我回答一声:发吧。在SMTP协议中,也是同样,协议会返回一个标识码,来告诉我们服务器现在的状态,在我们打招呼之后,服务器一般会返回250,这告诉我们:“一切OK,放马过来吧”。

@yulanggong
yulanggong / calender.md
Created June 13, 2014 05:35
日历标准格式研究

日历标准格式研究

日历的导入导出

格式

现在通用的日历格式是 iCalendar,通常扩展名是 .ics

BEGIN:VCALENDAR #日历开始
@oblank
oblank / bleve_with_jieba.go
Last active May 14, 2024 15:57
bleve结合 jieba 分词实现中文分词
package main
import (
"fmt"
"github.com/blevesearch/bleve"
_ "github.com/wangbin/jiebago/analyse/tokenizers"
"log"
)
func main() {
#block video ad
/ip firewall layer7-protocol
add name=youku-tudou regexp="^.+(v2html.atm.youku.com|atm.youku.com|ad.api.3g.tudou.com|ad.api.3g.youku.com).*\$"
add name=tencent regexp="^.+(fp.qq.com|rcgi.video.qq.com|tj.video.qq.com).*\$"
add name=iqiyi regexp="^.+(api.cupid.iqiyi.com).*\$"
add name=letv regexp="^.+(fz.letv.com|dc.letv.com|ark.letv.com).*\$"
add name=crossdomain regexp="^.+(crossdomain.xml).\$"
/ip firewall filter
add action=reject chain=forward comment="\CC\DA\D1\B6\CA\D3\C6\B5" layer7-protocol=tencent protocol=tcp reject-with=tcp-reset
@stuartlangridge
stuartlangridge / icloud-cal.php
Created January 26, 2016 22:49
PHP to fetch a calendar from iCloud with authentication and CalDAV
<?php
// get this data by logging into icloud.com on the calendars page and looking at the dev tools
// as per https://translate.google.com/translate?sl=de&tl=en&js=y&prev=_t&hl=de&ie=UTF-8&u=http%3A%2F%2Fnico-beuermann.de%2Fblogging%2Farchives%2F115-Zugriff-auf-iCloud-Kalender-mit-Thunderbird.html&edit-text=&act=url
$account = array(
'server' => '', // note, this will be p12 or something, not P0; see the server that iclod.com serves json from
'icloudid' => '', // the "dsid"
'appleid' => '', // your Apple ID; will be an email address
'pass' => '', // password for your Apple ID
'calid' => '' // the "pGuid"
@xpn
xpn / clr_via_native.c
Created April 11, 2018 21:34
A quick example showing loading CLR via native code
#include "stdafx.h"
int main()
{
ICLRMetaHost *metaHost = NULL;
IEnumUnknown *runtime = NULL;
ICLRRuntimeInfo *runtimeInfo = NULL;
ICLRRuntimeHost *runtimeHost = NULL;
IUnknown *enumRuntime = NULL;
LPWSTR frameworkName = NULL;
@richlander
richlander / instructions.md
Last active March 24, 2024 14:54
Installing .NET Core 3.0 on Linux ARM64

Installing .NET Core on Linux ARM64

The following intructions can be used to install .NET Core on Linux ARM64.

Pro tip: Check out .NET Core Docker files to determine the exact instructions for installing .NET Core builds, for example .NET Core 3.1 ARM32 SDK Dockerfile.

Installing .NET Core Globally

The following instructions install the latest .NET Core globally. It isn't required to do that, but it provides the best experience.