Skip to content

Instantly share code, notes, and snippets.

println("Hello")
var conn = Socket().connect(8000, address: "127.0.0.1").listen(limit:128).accept() { connection, address in
println("Accepted a connection from port \(address.addressString)")
return connection
}.read() { connection, inStr in
let arr = inStr.componentsSeparatedByString("\n")
let response = (arr[0].uppercaseString + "\n")
return connection.write(response)
}.close()
@Chrisedmo
Chrisedmo / Mountain Lion tweaks
Created July 30, 2012 14:30
Mountain Lion tweaks (under the hood)
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
scutil --set ComputerName "MathBook Pro"
scutil --set HostName "MathBook Pro"
scutil --set LocalHostName "MathBook-Pro"
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active June 1, 2024 03:14
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
@msantos
msantos / bpf.c
Last active April 2, 2024 18:54
Example of using bpf to capture packets
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <err.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>