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 on | |
set nocompatible | |
set clipboard=unnamed " yank and paste with the system clipboard | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle | |
" required! |
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 <stdio.h> | |
#include <time.h> | |
using namespace std; | |
int main() | |
{ | |
// declarations & initialisations | |
//time_t start = time(NULL); | |
//int sec; |
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 array | |
import sys | |
MIL = 10**6 | |
def running_sum(a): | |
tot = 0 | |
for item in a: | |
i = int(item) | |
if i < 0 or i > MIL: |
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
def fancy_sort(countries): | |
""" countries -> list of countries """ | |
sorted_countries = [(-1 * len(x[1]) if x[0] % 2 else len(x[1]), x[1]) | |
for x in enumerate(sorted(countries, key=len))] | |
return [x for x in sorted(sorted_countries, key=lambda x: x[0])] | |
countries = ['Afghanistan', 'Albania', 'Algeria', 'Andorra', 'Angola', 'Antigua & Deps', 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bhutan', 'Bolivia', 'Bosnia Herzegovina', 'Botswana', 'Brazil', 'Brunei', 'Bulgaria', 'Burkina', 'Burundi', 'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Central African Rep', 'Chad', 'Chile', 'China', 'Colombia', 'Comoros', 'Congo', 'Congo {Democratic Rep}', 'Costa Rica', 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic', 'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic', 'East Timor', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'Fiji |
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 sys | |
## Typical Usage: | |
## python parse_transalations.py 'path/to/messages.po' | |
## This prints the strings and their respective translations | |
def clean(s): | |
""" Quick and dirty scrubbing of the data """ | |
return s.replace('"', '').replace('msgid ', '').replace('msgstr ', '') |
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
-- Using folds version | |
import Data.List | |
import Data.Maybe | |
letters = "acdegilmnoprstuw" | |
getIndexOf :: Char -> String -> Int | |
getIndexOf x xs = fromMaybe (-1) (elemIndex x xs) | |
hashacc :: Int -> Char -> Int |
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
main = lift clock (every second) | |
number n = let angle = degrees (90 - 6 * (n * 5)) | |
in move (100 * cos angle, 100 * sin angle) (toForm (asText n)) | |
displayNumbers = group (map number [1..12]) | |
clock t = collage 400 400 [ outlined (solid blue) (circle 110) |
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 simplegui | |
import random | |
class Direction(object): | |
UP, DOWN, LEFT, RIGHT = range(4) | |
class GameState(object): | |
RUNNING, FINISHED = range(2) |
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 sys | |
# needed for casting PyCObject to void pointer | |
from ctypes import pythonapi, c_void_p, py_object | |
from PySide.QtCore import * | |
from PySide.QtGui import * | |
import gobject | |
import pygst |
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 abc | |
class AbstractV(object): | |
__metaclass__ = abc.ABCMeta | |
def __init__(self, **kwargs): | |
for k, v in kwargs.iteritems(): |
OlderNewer