This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Pascals Triangle in C | |
* | |
* Hacker News: http://news.ycombinator.com/item?id=3428984 | |
* | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Pascal2.c | |
* | |
* Pascals Triangle in C | |
* | |
* See notes below. | |
* To run: | |
gcc -std=c99 pascal2.c -o pascal2 && ./pascal2 10 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from Foundation import * | |
from QuartzCore import * | |
from UIKit import * | |
import console | |
WKWebView = ObjCClass('WKWebView') | |
@on_main_thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#include <dlfcn.h> | |
NSDictionary *FCPrivateBatteryStatus() | |
{ | |
static mach_port_t *s_kIOMasterPortDefault; | |
static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options); | |
static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT); | |
static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate rand; | |
use rand::Rng; | |
use std::io; | |
// From "Practical Programs for the BBC Computer and Acorn ATOM" | |
// (c) David Johnson-Davies | |
// Sigma Technical Press 1983 | |
// Silver Dollar Game | |
// http://www.acornatom.nl/atom_plaatjes/boeken/pracprog/pp.htm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
//module <%= namespace %> | |
// needed to make inference work e.g. num.MaxValue ??? | |
// cite here: | |
type num = int32 | |
// read from file | |
let lines filePath = System.IO.File.ReadLines(filePath);; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------------------------- | |
// NSData+JWUtil | |
// Provide a rangeOfData:options:range: method for pre-4.0 iOS. | |
//-------------------------------------------------------------------------------- | |
@interface NSData (JWUtil) | |
- (NSRange)rangeOfDataX:(NSData *)dataToFind options:(NSDataSearchOptions)mask range:(NSRange)searchRange; | |
@end | |
//-------------------------------------------------------------------------------- | |
// NSData+JWUtil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef UTILS_HPP | |
#define UTILS_HPP | |
// Advent of Code 2018 | |
// utils.hpp | |
#include <iterator> | |
// Count non-matching values over two ranges of iterators | |
// See: https://en.cppreference.com/w/cpp/algorithm/count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef READER_HPP | |
#define READER_HPP | |
// Advent of Code 2018 | |
// Handy text file reader returning vector<string> | |
// See: https://stackoverflow.com/a/1567703/33758 | |
#include <iostream> | |
#include <fstream> | |
#include <string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Advent of Code 2018 | |
// Day 05 - Alchemical Reduction | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
int react(char * s) { | |
char *r = s+1, *w = s; | |
while (*r) |
OlderNewer