Skip to content

Instantly share code, notes, and snippets.

View H2CO3's full-sized avatar
🦀

Árpád Goretity  H2CO3

🦀
View GitHub Profile
@H2CO3
H2CO3 / p92.spn
Created December 11, 2013 23:18
Solution to Project Euler problem #92 as suggested by Daniel Silverstone.
/*
* p92.spn
*
* a solution to Project Euler problem #92
* using the Sparkling scripting language
*/
function next(n)
{
var s = 0;
@H2CO3
H2CO3 / p42.spn
Created December 10, 2013 21:15
Project Euler problem #42 solution in Sparkling
/*
* p42.spn
* Solution to Project Euler problem #42
*
* Created by Arpad Goretity on 10/12/2013
*/
function FileSize(file)
{
fseek(file, 0, "end");
@H2CO3
H2CO3 / p89
Last active December 26, 2015 02:09
Sparkling demo: solution to Project Euler problem #89
/*
* Created by Árpád Goretity on 21/10/2013
*
* Sparkling demo: solution to Project Euler problem #89
* (http://projecteuler.net/problem=89)
*
* For demonstration purposes only -- please don't abuse or cheat.
*/
function int2roman(r)
@H2CO3
H2CO3 / guardhdr.sh
Created October 12, 2013 06:00
This script appends an automatically generated include guard to a specified header file. Optionally, you can provide a prefix that will be added to the guard macro.
#!/bin/bash
if [ "$#" = "0" ]; then
echo "at least one argument is required"
exit 1
fi
FILE=$1
GUARD="$2$(printf "%s" $FILE | tr '.' '_' | tr '[[:lower:]]' '[[:upper:]]')"
@H2CO3
H2CO3 / main.m
Created August 3, 2013 22:14
Patch for https://github.com/xslim/mobileDeviceManager to support copying files *from* the device. Insert this at line 75 into Source/main.m.
} else if ([option isEqualToString:@"copyFrom"]) {
NSLog(@"Copying...");
AFCApplicationDirectory *appDir = [device newAFCApplicationDirectory:[arguments stringForKey:@"app"]];
AFCFileReference *infile = [appDir openForRead:[arguments stringForKey:@"from"]];
if (!infile) {
NSLog(@"Error: %@", [appDir lasterror]);
}
char buf[0x10000];
int outfile = open([arguments stringForKey:@"to"].UTF8String, O_CREAT | O_WRONLY, 0777);