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
>>> from git import * | |
>>> repo = Repo( | |
... "C:\Users\deostroll\Documents\GitHub\synchost") | |
>>> repo | |
<git.Repo "C:\Users\deostroll\Documents\GitHub\synchost\.git"> | |
>>> repo.is_dirty() | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "C:\Python27\lib\site-packages\git\repo\base.py", line 502, in is_dirty | |
len(self.git.diff('HEAD', '--cached', *default_args)): |
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
struct EnumWindowsCallbackArgs { | |
EnumWindowsCallbackArgs( DWORD p ) : pid( p ) { } | |
const DWORD pid; | |
std::vector<HWND> handles; | |
}; | |
EnumWindowsCallbackArgs args( ::GetCurrentProcessId() ); |
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
Python 2.7.3 (default, Apr 20 2012, 22:44:07) | |
[GCC 4.6.3] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> def print_hello(): | |
... print 'Hello foo world' | |
... | |
>>> print_hello() | |
Hello foo world | |
>>> #some other arbitary function call | |
... #will result in an error |
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
Python 2.7.3 (default, Apr 20 2012, 22:44:07) | |
[GCC 4.6.3] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import os | |
>>> os.getcwd() | |
'/home/deostroll' | |
>>> |
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
$ cd ~/scripts/tmp | |
$ touch m1.py | |
$ pico m1.py | |
$ cat m1.py | |
print 'Imported module m1' | |
def m1foo(): | |
print 'executed m1 foo' | |
$ python | |
Python 2.7.3 (default, Apr 20 2012, 22:44:07) |
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 System; | |
using System.Collections.Generic; | |
using Newtonsoft.Json.Linq; | |
namespace caNewtonsoftJson | |
{ | |
class Person | |
{ | |
public string Name { get; set; } | |
public int Age { get; set; } |
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
(function(dt) { | |
return [dt.getHours(), dt.getMinutes(), dt.getSeconds()].map(function(n) { | |
return n < 10 ? '0' + n : n | |
}).join(':'); | |
})(new Date()) |
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
from math import factorial as fact | |
def comb(seq, r): | |
n = len(seq) | |
total = fact(n) / (fact(r) * fact(n-r)) | |
pos = range(r) | |
c= [] | |
i = 0 | |
while i < total: | |
c.append(map(lambda x: seq[x], pos)) |
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
from math import factorial as fact | |
def comb(seq, r): | |
n = len(seq) | |
total = fact(n) / (fact(r) * fact(n-r)) | |
pos = range(r) | |
#c= [] | |
i = 0 | |
while i < total: | |
#c.append(map(lambda x: seq[x], pos)) |
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 java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.NoSuchElementException; | |
public class Combinations<T> implements Iterable<ArrayList<T>> { | |
private int totalCombinations; | |
private int n, r; | |
private int factorial(int n) { |
OlderNewer