Skip to content

Instantly share code, notes, and snippets.

View nst's full-sized avatar

Nicolas Seriot nst

View GitHub Profile
@nst
nst / checkurl.py
Created March 5, 2014 14:58
Test dead links from a web page list. Written to help someone on a newsgroup.
#!/usr/bin/python
__version__ = "$Revision: 0.2 $"
__author__ = "Nicolas Seriot"
__date__ = "2005-07-20"
""""
Test dead links from a web page list.
Written to help someone on a newsgroup.
@nst
nst / timer.py
Created March 5, 2014 15:00
Starts a timer. Useful for tea or cooking.
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
__version__ = "$Revision: 0.1$"
__author__ = "Nicolas Seriot"
__date__ = "2005-01-16"
""""
Her: Would you count 2 minutes and a half plase?
Me : $ timer 2 30
@nst
nst / bpm.py
Created March 5, 2014 15:01
Counts the number of heartbeats per minute.
#!/usr/bin/python
""""
Counts the number of heartbeats per minute.
For example, you can use it to count your mp3's bpm or your number or heartbeats or breaths per minute.
$ python bpm.py
BPM - Calcule les bpm sur les 4 derniers beats.
Appuyer sur a chaque beat, 'q' pour quitter.
# http://corkami.googlecode.com/svn/trunk/src/HexII/
$ ./hello
Hello world
$ hexdump hello
0000000 ce fa ed fe 07 00 00 00 03 00 00 00 02 00 00 00
0000010 02 00 00 00 88 00 00 00 01 00 00 00 01 00 00 00
0000020 38 00 00 00 5f 5f 54 45 58 54 00 00 00 00 00 00
0000030 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00
@nst
nst / DrawingUnicode
Last active August 29, 2015 14:04
Draw all Unicode code points in all 16 planes, see http://seriot.ch/visualization/unicode/
//
// main.m
// Unicode
//
// Created by Nicolas Seriot on 26/07/14.
// Copyright (c) 2014 Nicolas Seriot. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#!/usr/bin/env python
HIGH_BITS_MAX = 0xFF
LOW_BITS_MAX = 0xFF
def write_plane(plane_number, path):
with open(path, 'w+') as f:
f.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
//
// main.m
// Unicode
//
// Created by Nicolas Seriot on 26/07/14.
// Copyright (c) 2014 Nicolas Seriot. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
@nst
nst / NSManagedObject+NST.h
Created April 24, 2010 20:40
Objective-C category to ease NSManagedObject usage with a single context (.h)
#import <CoreData/CoreData.h>
@interface NSManagedObject (NST)
+ (NSManagedObjectContext *)moc;
+ (NSManagedObjectModel *)mom;
+ (NSEntityDescription *)entity;
+ (NSFetchRequest *)allFetchRequest;
+ (NSArray *)allObjects;
+ (NSUInteger)allObjectsCount;
@nst
nst / NSManagedObject+NST.m
Created April 24, 2010 20:41
Objective-C category to ease NSManagedObject usage with a single context (.m)
#import "NSManagedObject+NST.h"
@implementation NSManagedObject (NST)
+ (id)create {
NSEntityDescription *entityDecription = [self entity];
NSString *name = [entityDecription name];
return [NSEntityDescription insertNewObjectForEntityForName:name inManagedObjectContext:[self moc]] ;
}
@nst
nst / orange_sms.py
Created August 8, 2012 16:38
Automates SMS sending from orange.ch
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""Automates SMS sending from orange.ch, works on 2012-08-08"""
import requests # pip install requests
import re
import sys
def get_sun_query_params():