This file contains hidden or 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 System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Reflection; | |
using System.Linq.Expressions; | |
using System.Reflection.Emit; | |
using System.IO; |
This file contains hidden or 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
public class WebClientEx : WebClient | |
{ | |
public WebClientEx(CookieContainer container) | |
{ | |
this.container = container; | |
} | |
private readonly CookieContainer container = new CookieContainer(); | |
protected override WebRequest GetWebRequest(Uri address) |
This file contains hidden or 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
Clear-Item -Path alias:dir | |
function dir | |
{ | |
Invoke-Expression "cmd /c dir $args" | |
} | |
Clear-Item -Path alias:cd | |
New-Alias -Name cd -Value Push-Location | |
$env:Path = ".\;$env:Path" |
This file contains hidden or 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 logging | |
import urllib2 | |
import re | |
from contextlib import closing | |
def get_ip(url = "http://checkip.dyndns.org/"): | |
'''Get local machine (or router)'s external IP from a IP checking web | |
service. | |
url: the URL of the IP checking service. Default to |
This file contains hidden or 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
"""Find all paths in a binary tree that the nodes on the path sums up to a specified vale. | |
""" | |
from collections import deque | |
def find_path(T,X): | |
""" | |
On each node it visits, it marks the node's parent. This is for tracing | |
upwards. | |
""" | |
res = [] |
This file contains hidden or 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 Queue import Queue | |
def find_path(E, V, n1, n2): | |
"""Find path between n1,n2 of a directed graph""" | |
for n in E: | |
n.from_ = None | |
q = Queue() | |
q.put(n1) | |
found = False | |
while not q.empty(): |
This file contains hidden or 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
// Deprecated in favor of https://github.com/puzzl3r/puzzles/tree/master/CheckTreeBalance | |
using System.Diagnostics; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication8 | |
{ |
This file contains hidden or 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 System.Diagnostics; | |
namespace ConsoleApplication7 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains hidden or 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.Text; | |
using System; | |
using System.Diagnostics; | |
namespace ConsoleApplication15 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains hidden or 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.Diagnostics; | |
using System.Collections.Generic; | |
namespace ConsoleApplication4 | |
{ | |
/// <summary> | |
/// | |
/// </summary> | |
/// <remarks> |