Skip to content

Instantly share code, notes, and snippets.

View cfr's full-sized avatar
💭
👾

Stan Serebryakov cfr

💭
👾
View GitHub Profile
syntax:glob
main
*.o
#import <stdio.h>
#import <highgui.h>
#import <cv.h>
IplImage *renderFaces(IplImage *, CvSeq *, double);
int main(int argc, char** argv)
{
double scale = 5; // primary speed factor
Interpreted & compiled Haskell & C + interpreted Python
=======================================================
$ time sh ./nice-langs.sh >> /dev/null
* real *9.117* s
* user 2.370 s
@cfr
cfr / gist:1273958
Created October 9, 2011 18:00 — forked from javan/gist:1168475
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
#import <stdio.h>
#import <highgui.h>
#import <cv.h>
IplImage *renderFaces(IplImage *, CvSeq *, double);
int main(int argc, char** argv)
{
double scale = 2; // primary speed factor
@cfr
cfr / SBT-output
Created January 21, 2013 15:11
got 100+ lines error from Scala
app: Starting ru.*.ar.Main.main()
[success] Total time: 1 s, completed Jan 21, 2013 6:58:22 PM
> app: 01/21 18:58:27.540 INFO [lt-dispatcher-3] a.e.s.Slf4jEventHandler - Slf4jEventHandler started
app: 01/21 18:58:28.285 INFO [lt-dispatcher-1] akka://ru-*-ar-Main/user/io-bridge/sub-0 - akka://ru-*-ar-Main/user/io-bridge/sub-0 started
app: 01/21 18:58:28.289 INFO [lt-dispatcher-1] akka://ru-*-ar-Main/user/io-bridge/sub-1 - akka://ru-*-ar-Main/user/io-bridge/sub-1 started
app: 01/21 18:58:28.293 INFO [lt-dispatcher-1] akka://ru-*-ar-Main/user/io-bridge - akka://ru-*-ar-Main/user/io-bridge started
app: 01/21 18:58:28.442 INFO [lt-dispatcher-1] akka://ru-*-ar-Main/user/http-server - akka://ru-*-ar-Main/user/http-server started on /0.0.0.0:6582
app: 01/21 18:58:34.032 ERROR[lt-dispatcher-1] akka://ru-*-ar-Main/user/ar-service - Error during processing of request HttpRequest(GET, /item/dragon/scene, List(Connection: keep-alive, Accept-Encoding: gzip, deflate, Accept-Language: en-us, dnt: 1, Accept: text/html, applic
#include <vector>
#include <iostream>
#include <cstdlib>
#include <ctime>
int main()
{
std::vector<std::string> v;
v.push_back("Yes");
import System.Random (randomRIO)
replies = ["Yes", "Signs point to yes", "It is certain", "It is decidedly so", "Without a doubt"
, "Yes, definitely", "You may rely on it", "As I see it yes", "Most likely", "Outlook good"
, "Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now"
, "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no"
, "Outlook not so good", "Very doubtful"]
randomElem [] = error "Empty list"
randomElem xs = randomRIO (0, length xs - 1) >>= return . (xs !!)
@cfr
cfr / sequence.m
Last active December 19, 2015 15:59
sequence
typedef void (^OpCompletionEither)(BOOL success);
- (void)sequence:(NSArray *)selectors
withFinalBlock:(OpCompletionEither)block {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
__block OpCompletionEither _block = block;
SEL selector = NSSelectorFromString(selectors[0]);
if (selectors.count == 1)
// last request, perform reply block
@cfr
cfr / generic-print.c11.c
Last active December 20, 2015 01:59
C11 _Generic print
#define printf_dec_format(x) _Generic((x), \
char: "%c", \
signed char: "%hhd", \
unsigned char: "%hhu", \
signed short: "%hd", \
unsigned short: "%hu", \
signed int: "%d", \
unsigned int: "%u", \
long int: "%ld", \
unsigned long int: "%lu", \