Skip to content

Instantly share code, notes, and snippets.

View orklann's full-sized avatar
🏠
Working from home

rkt orklann

🏠
Working from home
View GitHub Profile

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Set the SOCKS proxy to local SSH tunnel

networksetup -setsocksfirewallproxy "Ethernet" localhost 8080

To clear the domain and port

@orklann
orklann / snowden-ietf93.md
Last active August 29, 2015 14:27 — forked from mnot/snowden-ietf93.md
Transcript of Edward Snowden's comments at IETF93.

"JUST BECAUSE YOU'RE USING SWIFT DOESN'T MEAN YOUR QUESTION IS ABOUT SWIFT"

How To Get Answers

Ask your question and then be patient. Tell us what you want to happen, what is actually happening, and include any error messages you find:

  • Provide a scenario. "I am trying to do X, I do so by calling APIs W and Y, but Z happens instead. I see the following error messages:..."
  • Focus on the goal. Ask about what you're trying to achieve (the big story) rather than the specific technical detail that you believe is holding you back.
  • Don't solicit help. Don't say, "Does anyone here know about (for example) Protocol Extensions". Just ask your question.
  • Do your homework. Search the web before asking in-channel.
  • Be courteous Don't just paste Stack Overflow questions in-channel.
  • Remember the topic Refer questions about third party libraries to their developers.
@orklann
orklann / Swift-MD5.swift
Created March 30, 2017 03:37 — forked from finder39/Swift-MD5.swift
Swift MD5
extension String {
func md5() -> String! {
let str = self.cStringUsingEncoding(NSUTF8StringEncoding)
let strLen = CUnsignedInt(self.lengthOfBytesUsingEncoding(NSUTF8StringEncoding))
let digestLen = Int(CC_MD5_DIGEST_LENGTH)
let result = UnsafeMutablePointer<CUnsignedChar>.alloc(digestLen)
CC_MD5(str!, strLen, result)
var hash = NSMutableString()
@orklann
orklann / kevent_srv.py
Created April 27, 2017 05:04 — forked from ishworgurung/kevent_srv.py
So, how can I use kqueue/kevent on BSD/Mac using Python?
#!/usr/bin/env python
"""
Example on using Kqueue/Kevent on BSD/Mac
using Python.
The TCP server essentially echoes back the
message it receives on the client socket.
"""
__author__ = "Ishwor Gurung <ishwor@develworx.com>"
@orklann
orklann / tcp_timeout.go
Created May 8, 2017 11:50 — forked from hongster/tcp_timeout.go
Golang example on handling TCP connection and setting timeout.
package main
import (
"fmt"
"net"
"time"
"bufio"
)
func handleConnection(conn net.Conn) {
今天发现 GitHub 有两步验证的功能,于是打算开启,可是悲剧的是,到了填写手机号的时候,发现没有 China 的选项。
于是我尝试了下修改网页源代码,添加了 `<option value="+86">China +86</option>` 再填手机号,居然就收到短信了。
后来有点不放心,还是给 https://github.com/contact 发了个反馈,然后收到回信说由于某些国家的短信发送成功率无法保证,所以没有开启两步验证功能。
不过在我这段时间的使用过程中,还是挺稳定的,每次都能收到短信。
大家如果也需要开启两步验证,最好把 Recover code 也记下来吧,避免以后短信收不到。
@orklann
orklann / node.dart
Created July 6, 2017 08:55 — forked from azenla/node.dart
Node.js Interop
library nodejs;
import "dart:js";
/**
* Simple Helper Class
*/
class Console {
void log(String message) => context['console'].callMethod("log", [message]);
@orklann
orklann / hello_world.py
Created May 22, 2018 09:37 — forked from uchcode/hello_world.py
pyobjc example.
#!/usr/bin/python2.6
# -*- coding: utf-8 -*-
import objc
from Foundation import *
from AppKit import *
from PyObjCTools import AppHelper
NSWindowDelegate = objc.protocolNamed("NSWindowDelegate")
@orklann
orklann / setup_bpy.sh
Created July 25, 2018 09:23 — forked from xunkai55/setup_bpy.sh
Setup bpy (Blender as a python module) on Mac OS X
# Do not excute the script directly. It is just for demonstration.
# If you followed the documentation and got the errors below, please take a look at this guide.
# Color management: using fallback mode for management
# bpy: couldnt find 'scripts/modules', blender probably wont start.
# Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.
# ImportError: No module named 'bpy_types'
# ImportError: No module named 'bpy_types'
# pyrna_srna_ExternalType: failed to find 'bpy_types' module
# ImportError: No module named 'bpy_types'