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
private static void ShuffleArray(IList<int> array) | |
{ | |
if (array == null) throw new ArgumentNullException("array"); | |
var r = new Random((int) DateTime.Now.Ticks); | |
for (int i = array.Count-1; i >= 0; --i) | |
{ | |
var index = r.Next(i+1); | |
if (index == i) continue; |
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
template<class _Ty> | |
class MyAllocator | |
: public _Allocator_base<_Ty> | |
{ // generic MyAllocator for objects of class _Ty | |
public: | |
typedef MyAllocator<_Ty> other; | |
typedef _Allocator_base<_Ty> _Mybase; | |
typedef typename _Mybase::value_type value_type; |
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
#include <functional> | |
#include <deque> | |
#include <stdexcept> | |
template<class T = void*> class Chain { | |
public: | |
typedef Chain<T> my_type; | |
typedef std::function< T (my_type &) > callback; | |
typedef std::function< void (my_type &, std::exception &) > fail_callback; |
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
"file_regex": "^(.*?):([0-9]+):?([0-9]+)?:? error:(.*)$" |
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 subprocess | |
def is_python_module_installed(module): | |
command = ['pip', 'list'] | |
p = PO( command, stdin=PIPE, stdout = PIPE, stderr = PIPE) | |
output,err = p.communicate | |
for module in output.decode('utf-8').splitlines(): | |
if module.split(' ')[0] == module: | |
return True |
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
/** | |
* Data Compression Proxy Extension for Google Chrome on Desktop | |
* (c) 2014 Jerzy Głowacki. License: Apache 2.0 | |
*/ | |
var MD5 = function(e) { | |
function h(a,b){var c,d,e,f,g;e=a&2147483648;f=b&2147483648;c=a&1073741824;d=b&1073741824;g=(a&1073741823)+(b&1073741823);return c&d?g^2147483648^e^f:c|d?g&1073741824?g^3221225472^e^f:g^1073741824^e^f:g^e^f}function k(a,b,c,d,e,f,g){a=h(a,h(h(b&c|~b&d,e),g));return h(a<<f|a>>>32-f,b)}function l(a,b,c,d,e,f,g){a=h(a,h(h(b&d|c&~d,e),g));return h(a<<f|a>>>32-f,b)}function m(a,b,d,c,e,f,g){a=h(a,h(h(b^d^c,e),g));return h(a<<f|a>>>32-f,b)}function n(a,b,d,c,e,f,g){a=h(a,h(h(d^(b|~c),e),g));return h(a<<f|a>>>32-f,b)}function p(a){var b="",d="",c;for(c=0;3>=c;c++)d=a>>>8*c&255,d="0"+d.toString(16),b+=d.substr(d.length-2,2);return b}var f=[],q,r,s,t,a,b,c,d;e=function(a){a=a.replace(/\r\n/g,"\n");for(var b="",d=0;d<a.length;d++){var c=a.charCodeAt(d);128>c?b+=String.fromCharCode(c):(127<c&&2048>c?b+=String.fromCharCode(c>>6|192):(b+=String.fromCharCode(c>>12|224),b+=Stri |
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
@echo off | |
rmdir /Q /S build | |
echo "Build removed" | |
pushd stub-cpp\src\main\python | |
git co develop | |
git pull | |
python build_env.py debug |
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
#{ "keys": [ "ctrl+alt+v" ], "command": "open_in_browser" }, | |
import sublime, sublime_plugin | |
import webbrowser | |
import os.path | |
import sys | |
class OpenInBrowserCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
filePath = self.view.file_name() | |
fileToOpen = os.path.basename(filePath) |
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 os | |
import shutil | |
import subprocess | |
def generate_project(): | |
command = ['python', 'generate_project.py', 'release'] | |
result = subprocess.call(command) | |
if result == 0: | |
print 'Project generated' | |
return True |
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
# Install package | |
sudo apt install -y ccache | |
# Update symlinks | |
sudo /usr/sbin/update-ccache-symlinks | |
# Prepend ccache into the PATH | |
echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc | |
# Source bashrc to test the new PATH |
OlderNewer