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
#include <iostream> | |
struct a | |
{ | |
int b; | |
double c; | |
}; | |
using namespace std; | |
int main() |
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
// gcc no-return-value.c --- prints 0 | |
// g++ no-return-value.c --- prints a random 32-bit integer | |
// (using gcc 4.4) | |
#include "stdio.h" | |
int a() { } | |
int main() { | |
printf("%d", a()); | |
} |
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
#!/usr/bin/ruby | |
# This script prints your current public IP | |
# | |
# It retrieves it using http://checkip.dyndns.org web page. | |
# If given a parameter, it treats it as (float) number of seconds | |
# before timeout. The default timeout is set to 10 seconds. | |
# | |
# Author: Jan Pipek (jan.pipek AT gmail.com) |
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
#!/bin/env/python | |
# How inheritance of constructors in python works. | |
# Only simple cases without multiple inheritance are covered. | |
class A(object): | |
"""No inheritance""" | |
def __init__(self): | |
print "A" | |
class B(A): |
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
#include <iostream> | |
#include <sstream> | |
#include <cmath> | |
#include <climits> | |
const int DEPTH = 7; | |
// Reasonable values are 3,5,7. However the 7 version takes a very long time to compile (a few minutes). | |
// Use g++ -O3 prime.cpp if possible. | |
using namespace std; |
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
syntax: glob | |
# Back-up | |
*~ | |
# Executables | |
**/build/** | |
*.o | |
.depend |
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
/** | |
* Simple jQuery utility for saving element values in localStorage. | |
* | |
* Usage: | |
* - Add class "store-state" to the element you want to save. | |
* - Add id attribute to the element or specify your own storage key (attribute data-storage-name) | |
* - Add attribute "data-storage-name" to the element if you | |
* want to control under which name the value will be stored | |
* - Add attribute "data-storage-noload" to suppress loading (will be stored though, it is | |
* useful, when HTML-specified value is temporarily more important). |
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
#!/usr/bin/env python | |
import sys | |
import pkgutil | |
import os | |
if len(sys.argv) != 2: | |
print("Usage: sublime_load.py <package-name>") | |
else: | |
package = sys.argv[1] | |
loader = pkgutil.find_loader(package) |
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 h5py | |
import os | |
def _report(operation, key, obj): | |
type_str = type(obj).__name__.split(".")[-1].lower() | |
print "%s %s: %s." % (operation, type_str, key) | |
def h5py_compatible_attributes(in_object): | |
'''Are all attributes of an object readable in h5py?''' | |
try: |
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
%load_ext autoreload | |
%aimport module_to_be_reload # Select modules to be reloaded | |
%autoreload 1 # Set that we want only the listed modules |
OlderNewer