Skip to content

Instantly share code, notes, and snippets.

View Zaxuhe's full-sized avatar

Vicente Benavent Valenzuela Zaxuhe

View GitHub Profile
@sirupsen
sirupsen / brainfuck.c
Created January 22, 2010 15:18
Brainfuck parser in C using seeks.
#include <stdio.h>
#include <stdlib.h>
static char *ptr;
int do_command(const char command, FILE *pFile)
{
char c;
int pos;
@lexrus
lexrus / asicon.sh
Created March 6, 2012 08:48
AppStore Icons Generator
#!/bin/bash
# According to https://developer.apple.com/library/ios/#qa/qa1686/_index.html
# Install ImageMagick with MacPort: sudo port install ImageMagick
convert $1 -resize 512x512 iTunesArtwork.png # Ad Hoc iTunes
convert $1 -resize 144x144 Icon-72@2x.png # Home screen for "The New iPad"
convert $1 -resize 114x114 Icon@2x.png # Home screen for Retina display iPhone/iPod
convert $1 -resize 72x72 Icon-72.png # App Store and Home screen on iPad
convert $1 -resize 58x58 Icon-Small@2x.png # Spotlight and Settings for Retina display
convert $1 -resize 57x57 Icon.png # Home screen on non-Retina iPhone/iPod
convert $1 -resize 50x50 Icon-Small-50.png # Spotlight on iPad 1/2
public static class HumanNameGenerator
{
public enum Gender
{
Unknown = 0,
Male = 1,
Female = 2
}
private static readonly Random Rand = new Random((int)DateTime.Now.Ticks);
@usagi
usagi / emscripten_run_script_with_web_storage.cxx
Created May 11, 2014 06:18
Hello, Filesystem or Web Local Storage! with emscripten_run_script_string version.
#include <iostream>
#include <fstream>
#include <string>
#ifdef EMSCRIPTEN
#include <emscripten/emscripten.h>
#endif
namespace
{
@mbrav
mbrav / FPS.ino
Last active July 26, 2022 21:12
A simple Arduino loop "FPS" counter - v1.1
/*
Simple Arduino loop FPS counter v1.1
Created 2 Mar 2015
Updated 22 Feb 2016
by Michael Braverman
CHANGE LOG
v1.1 - added optimizations
- changed '>' operators to '>='
#!/bin/bash
f=$(pwd)
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/iTunesArtwork@2x.png"
sips --resampleWidth 57 "${f}/${1}" --out "${f}/app-icon.png"
sips --resampleWidth 114 "${f}/${1}" --out "${f}/app-icon@2x.png"
sips --resampleWidth 29 "${f}/${1}" --out "${f}/app-icon-29.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/app-icon-29@2x.png"
@forcewake
forcewake / extractTextBetweenCurlyBraces.js
Created June 5, 2015 12:55
Getting content between curly braces in javascript regex
var found = [], // an array to collect the strings that are found
rxp = /{([^}]+)}/g,
str = "a {string} with {curly} braces",
curMatch;
while( curMatch = rxp.exec( str ) ) {
found.push( curMatch[1] );
}
console.log( found ); // ["string", "curly"]
@ruby0x1
ruby0x1 / FPS.hx
Last active July 12, 2017 11:47 — forked from AndreiRudenko/Fps.hx
Simple FPS Text instance, modified from @RudenkoArt as an example for http://luxeengine.com
package;
import luxe.Text;
import luxe.Color;
import luxe.Vector;
import luxe.Log.*;
import luxe.options.TextOptions;
class FPS extends Text {
@guumaster
guumaster / 00-README.md
Last active January 23, 2023 15:48
How to upload a file with $.ajax to AWS S3 with a pre-signed url

Upload a file with $.ajax to AWS S3 with a pre-signed url

When you read about how to create and consume a pre-signed url on this guide, everything is really easy. You get your Postman and it works like a charm in the first run.

Then you open your browser, try your usual $.ajax() and send your PUT operation, and you hit the cold iced wall of AWS error message, a simple <Code>SignatureDoesNotMatch</Code> that will steal hours from your productivity.

So here I come to save you and give you a free working example of how to upload a file directly to AWS S3 from your browser. You are wellcome :).

@lolson
lolson / tailLog
Created April 19, 2016 21:53
A java implementation of tail
// See JLogTailer
public void tailLog(File file) {
boolean running = true;
int updateInterval = 1000;
long filePointer = file.length();
try {
while (running) {
Thread.sleep(updateInterval);
long length = file.length();