Skip to content

Instantly share code, notes, and snippets.

View nst's full-sized avatar

Nicolas Seriot nst

View GitHub Profile
@natecook1000
natecook1000 / NSScanner+Swift.swift
Created March 3, 2015 20:13
Swift-friendly NSScanner methods
// NSScanner+Swift.swift
// A set of Swift-idiomatic methods for NSScanner
//
// (c) 2015 Nate Cook, licensed under the MIT license
import Foundation
extension NSScanner {
// MARK: Strings
@steipete
steipete / NullabilityMacros.h
Created February 25, 2015 23:22
Want nullability right away? This will degrade gracefully until you can drop Xcode 6.1/Xcode 6.2.
// Xcode 6.3 defines new language features to declare nullability
#if __has_feature(nullability)
#define PSPDF_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
#define PSPDF_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
#define ps_nullable nullable
#define ps_nonnull nonnull
#define ps_null_unspecified null_unspecified
#define ps_null_resettable null_resettable
#define __ps_nullable __nullable
#define __ps_nonnull __nonnull
@roachhd
roachhd / README.md
Last active June 3, 2024 11:26
Basics of BrainFuck

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

BrainFuck Programming Tutorial by: Katie

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

INTRODUCTION

@kongtomorrow
kongtomorrow / gist:80ff47743d2c63355c42
Last active August 29, 2015 14:09
Swift + Unicode evilness :-D
let é = "precomposed character!"
let é = "decomposed characters!"
println(é) // prints "precomposed character!"
println(é) // prints "decomposed characters!"
@SevenW
SevenW / HTTPWebSocketsHandler.py
Last active October 23, 2023 13:10
HTTPWebSocketsHandler extends SimpleHTTPServer with WebSockets enabling the use of HTTP and WebSockets throught the same port
'''
The MIT License (MIT)
Copyright (C) 2014, 2015 Seven Watt <info@sevenwatt.com>
<http://www.sevenwatt.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
anonymous
anonymous / gist:64ba9e34a018ebd86f70
Created September 1, 2014 08:02
# bash, dash, sh, ...
# curl URL_OF_THIS_GIST >> ~/.profile
# wget URL_OF_THIS_GIST -O - >> ~/.profile
#
# zsh
# curl URL_OF_THIS_GIST >> ~/.zprofile
# wget URL_OF_THIS_GIST -O - >> ~/.zprofile
{
echo 'with open("/proc/self/mem", "r+") as f:'
echo ' f.seek(id(6*9)+16)'
@jbafford
jbafford / gist:d91ac15cf79a22e70f65
Created August 4, 2014 21:03
List OSX codesign versions for installed apps
find /Applications ~/Applications -maxdepth 3 -name "*.app" | while read a ; do echo; echo -n "$a ___ "; codesign -vd "${a}" 2>&1 | awk '/version/ {print $3}'; done | awk -F'___' '{print $2 " " $1}' | sort -u
@mxswd
mxswd / TypeNats.swift
Last active December 12, 2016 19:24
Thanks @robrix and CodaFi_ for the discussion :D
// this is a playground
protocol Nat {
class func construct() -> Self
class func value() -> Int
}
struct Z : Nat {
static func construct() -> Z {
return Z()
}
static NSString * const CCErrorDomain = @"com.apple.commoncrypto.error";
static NSString * CCDescriptionForStatus(CCCryptorStatus status) {
static NSString * const _CCStatusDescriptions[] = {
[-kCCSuccess] = @"Operation completed normally.",
[-kCCParamError] = @"Illegal parameter value.",
[-kCCBufferTooSmall] = @"Insufficent buffer provided for specified operation.",
[-kCCMemoryFailure] = @"Memory allocation failure.",
[-kCCAlignmentError] = @"Input size was not aligned properly.",
[-kCCDecodeError] = @"Input data did not decode or decrypt properly.",
@eelsivart
eelsivart / heartbleed.py
Last active June 7, 2024 02:16 — forked from sh1n0b1/ssltest.py
Heartbleed (CVE-2014-0160) Test & Exploit Python Script
#!/usr/bin/python
# Modified by Travis Lee
# Last Updated: 4/21/14
# Version 1.16
#
# -changed output to display text only instead of hexdump and made it easier to read
# -added option to specify number of times to connect to server (to get more data)
# -added option to send STARTTLS command for use with SMTP/POP/IMAP/FTP/etc...
# -added option to specify an input file of multiple hosts, line delimited, with or without a port specified (host:port)