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
| [Unit] | |
| Description=HAProxy Load Balancer | |
| Documentation=man:haproxy(1) | |
| Documentation=file:/usr/share/doc/haproxy/configuration.txt.gz | |
| After=network.target rsyslog.service | |
| [Service] | |
| # You can point the environment variable HAPROXY_STATS_SOCKET to a stats | |
| # socket if you want seamless reloads. | |
| EnvironmentFile=-/etc/default/haproxy |
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 ForEachWhile | |
| { | |
| class Program | |
| { | |
| static IEnumerable<int> Foo(int n) | |
| { |
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
| A = '00001111' | |
| B = '00110011' | |
| C = '01010101' | |
| def to_bool(s): | |
| return map(lambda c: True if c == '1' else False, s) | |
| def xorTuple(el): | |
| return el[0] != el[1] | |
| def main(): |
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 mkdir_if_not_exist(dirpath) | |
| if dirpath(end) ~= '/', dirpath = [dirpath '/']; end | |
| if (exist(dirpath, 'dir') == 0), mkdir(dirpath); end | |
| end |
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 myPowerConstructor(x) { | |
| var that = otherMaker(x); | |
| var secret = f(x); | |
| that.priv = function () { | |
| ... secret x that ... | |
| }; | |
| return that; | |
| } |
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 myPowerConstructor(x) { | |
| var that = otherMaker(x); | |
| var secret = f(x); | |
| that.priv = function () { | |
| ... secret x that ... | |
| }; | |
| return that; | |
| } |
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
| for %%i in (*.txt) do echo %%i | |
| Sometimes we want only filename. Use %~n1 instead | |
| Ex. | |
| for %%~ni in (*.txt) do echo %%~ni |
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 Point: | |
| def __init__(self, x=0, y=0): | |
| self.x = x | |
| self.y = y | |
| def linear(a, b, t): | |
| c = Point() | |
| c.x = (b.x - a.x)*t + a.x | |
| c.y = (b.y - a.y)*t + a.y | |
| return c |
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 edict_to_dict(edict): | |
| return dict([(key, val) for key, val in edict.iteritems()]) |
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 simplejson | |
| def json_response(request, obj): | |
| return HttpResponse(simplejson.dumps(obj)) |