Skip to content

Instantly share code, notes, and snippets.

View NachoSoto's full-sized avatar

NachoSoto NachoSoto

View GitHub Profile
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/4222316/hack.sh | sh
#
@NachoSoto
NachoSoto / compilation.txt
Last active December 20, 2015 17:39
Passing garbage as C++ arguments
$ clang++ -Wall -Werror -framework Foundation -std=c++11 -stdlib=libc++ garbage.mm -o test && ./test && echo $?
0 // MyClass didn't get initialized?
0 // method calls don't fail either
0 // exit code. No Crash?
#!/bin/bash
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 24 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
//
// MSRegex.cpp
// CoreMS
//
// Created by Nacho Soto on 6/27/14.
// Copyright (c) 2014 MindSnacks. All rights reserved.
//
#include "MSRegex.h"
#!/bin/bash
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i "$1" -r 24 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > "$1".gif
rm out-static*.png
else
ffmpeg -i "$1" -s 600x400 -pix_fmt rgb24 -r 24 -f gif - | gifsicle --optimize=3 --delay=3 > "$1".gif
fi
Incident Identifier: 0A56BB09-A7BF-40D4-9318-704746E02D80
CrashReporter Key: 34179ee1342c333e108a7bdd82b07ba9bb595bfc
Hardware Model: iPhone7,2
Process: Spotify [1254]
Path: /private/var/mobile/Containers/Bundle/Application/4841D500-3B9C-4340-960A-52F8D8ADAD2E/Spotify.app/Spotify
Identifier: com.spotify.client
Version: 170100007 (1.7.1)
Code Type: ARM (Native)
Parent Process: launchd [1]
@NachoSoto
NachoSoto / makemake.pl
Last active August 29, 2015 14:11 — forked from roop/makemake.pl
#!/usr/bin/perl -w
use strict;
# Makefile generator for quick compilation of Swift projects
# By: Roopesh Chander
# Thanks: Andy Matuschak
# Works only for swift-only projects.
# Usage:
# > perl makemake.pl
# > make
@NachoSoto
NachoSoto / makemake.pl
Last active August 29, 2015 14:11 — forked from roop/makemake.pl
#!/usr/bin/perl -w
use strict;
use Path::Iterator::Rule;
use String::ShellQuote;
# Makefile generator for quick compilation of Swift projects
# By: Roopesh Chander
# Thanks: Andy Matuschak
# Works only for swift-only projects.
@NachoSoto
NachoSoto / ExtendedProtocol
Last active August 29, 2015 14:12
Generic parameter ’T’ cannot be bound to non-@objc protocol type ‘Protocol’.
protocol BaseProtocol {}
protocol ExtendedProtocol: BaseProtocol {}
class A<T: BaseProtocol> {
private let t: T
init(a: T) { self.t = a }
}
class B<T: ExtendedProtocol> {
//select ::[a] ->[(a, [a])]
//select[] = []
//select(x:xs) = (x, xs) : [(y, x:ys) | (y, ys) <-select xs]
func select<T>(input: [T]) -> [(T, [T])] {
if (input.isEmpty) {
return []
} else {
let head = input[0]
let rest = Array(input[1..<input.count])