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
| class Node(object): | |
| def __init__(self, val): | |
| self.val = val | |
| self.next = None | |
| def sort(head, tail=None): | |
| if not head: | |
| return None | |
| if head.next == tail: |
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 java.util.Scanner; | |
| import java.util.HashMap; | |
| import java.io.BufferedReader; | |
| import java.io.FileNotFoundException; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| /* Basically create a cache by pre-processing | |
| the data file. And then it is just a data |
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
| def cycle_sort(arr): | |
| writes = 0 | |
| for cycle_start in xrange(len(arr)): | |
| item = arr[cycle_start] | |
| print "Item picked :%s index: %s [A: %s]" % (item, cycle_start, arr) | |
| pos = cycle_start | |
| for i in xrange(cycle_start + 1, len(arr)): | |
| if arr[i] < item: |
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
| Turn = 1000. | |
| 012345678901234567890123456789012345678901234567890123456789012345678901 | |
| 0 r....................................................................... | |
| 1 ........................................................................ | |
| 2 ........................................................................ | |
| 3 ........................................................................ | |
| 4 ........................................................................ | |
| 5 ........r..r............................................................ | |
| 6 ..........r............................................................. | |
| 7 ........................................................................ |
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
| function options() { | |
| PLUGIN_PATH="$HOME/.oh-my-zsh/plugins/" | |
| for plugin in $plugins; do | |
| echo "\n\nPlugin: $plugin"; grep -r "^function \w*" $PLUGIN_PATH$plugin | awk '{print $2}' | sed 's/()//'| tr '\n' ', '; grep -r "^alias" $PLUGIN_PATH$plugin | awk '{print $2}' | sed 's/=.*//' | tr '\n' ', ' | |
| done | |
| } |
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
| times = int(raw_input()) | |
| for i in xrange(times): | |
| num_str = raw_input() | |
| num = list(num_str) | |
| old_num = list(num) | |
| for j in xrange(len(num) - 1): | |
| k = j + 1 | |
| if max(num[k:]) > num[j]: | |
| k1 = k + num_str[k:].rfind(max(num[k:])) |
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
| {{- range $_, $key := .Values | keys | sortAlpha -}} | |
| {{- $value := index $.Values $key -}} | |
| {{- if kindIs "map" $value -}} | |
| {{- range $_, $nested_key := $value | keys | sortAlpha -}} | |
| {{- $nested_value := index $value $nested_key -}} | |
| {{- if kindIs "map" $nested_value -}} | |
| {{- range $_, $nested_nested_key := $nested_value | keys | sortAlpha -}} | |
| {{- $nested_nested_value := index $nested_value $nested_nested_key -}} | |
| {{- if kindIs "map" $nested_nested_value -}} | |
| {{- range $_, $nested_nested_nested_key := $nested_nested_value | keys | sortAlpha -}} |
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
| 2 git clone https://github.com/prat0318/flash.git | |
| 3 cd flash/ | |
| 4 sudo apt-get update | |
| 5 sudo apt-get install -y python-dev python-pip | |
| 6 sudo pip install -y pillow flask | |
| 7 sudo pip install pillow flask | |
| 8 ls | |
| 9 flask run | |
| 10 vi wsgi.py | |
| 11 ls |
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
| function FindProxyForURL(url, host) { | |
| PROXY = "SOCKS localhost:54311" | |
| if (shExpMatch(host,"10.129.*")) { | |
| return PROXY; | |
| } | |
| // Everything else directly! | |
| return "DIRECT"; | |
| } |
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
| function FindProxyForURL(url, host) { | |
| return "SOCKS localhost:54311"; | |
| } |