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 logging | |
from queue import Queue, Empty as EmptyQueue | |
from time import sleep | |
from threading import Thread | |
from typing import List | |
logger = logging.getLogger("watchdog") |
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
#!/bin/bash | |
set -e | |
# required arguments: | |
# WORKSPACE_DIR=Networking.xcworkspace | |
# SCHEME_NAME=Networking | |
# PRODUCT_NAME=Networking | |
CONFIGURATION=Release |
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 flask | |
-from werkzeug.http import Headers | |
+import bottle | |
[ ... ] | |
+# Remove "hop-by-hop" headers (as defined by RFC2613, Section 13) | |
+# since they are not allowed by the WSGI standard. | |
+FILTER_HEADERS = [ | |
+ 'Connection', |
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
/** Safe area for status bar dodging only. If you use NavigationBars, this won't help. | |
*/ | |
let topConstraint: NSLayoutConstraint | |
if #available(iOS 11.0, *) { | |
topConstraint = headerContainerView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor) | |
} else { | |
let statusBarHeight = UIApplication.shared.statusBarFrame.height | |
topConstraint = headerContainerView.topAnchor.constraint(equalTo: topAnchor, constant: statusBarHeight) | |
} |
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
#!/bin/sh | |
set -e | |
CERT_NAME='3rd Party Mac Developer Application: [YOUR NAME]' | |
APP_NAME='mygame.app' | |
ENTITLEMENTS='mygame.entitlements' | |
# remove existing meta files | |
find ${APP_NAME} -type f -regex '.*meta' -delete |
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
%{"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [], []}, | |
"db_connection": {:hex, :db_connection, "1.1.0", "b2b88db6d7d12f99997b584d09fad98e560b817a20dab6a526830e339f54cdb3", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, optional: true]}]}, | |
"decimal": {:hex, :decimal, "1.3.0", "418866ed19b8c2dace7860cf45ad017c521ff9c6d3a39da8d5974d277d8f079d", [:mix], []}, | |
"ecto": {:hex, :ecto, "2.1.0-rc.3", "63905a289ae923f1819574d71e79a90db5b3fbe50dbdaa60ab6a8c534c4e16be", [:mix], [{:db_connection, "~> 1.0-rc.4", [hex: :db_connection, optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, optional: false]}, {:mariaex, "~> 0.7.7", [hex: :mariaex, optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: false]}, {:postgrex, "~> 0.12.0", [hex: :postgrex, optional: 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
extern crate redis; | |
use redis::Commands; | |
use std::net::{TcpListener, TcpStream}; | |
use std::thread; | |
use std::io::Read; | |
fn handle_client(mut stream: TcpStream) -> redis::RedisResult<()> { |
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
# starting array | |
A = [5, -2, 10, 3, -25, 12, 6] | |
# calculating the max slice in O(n), starting from A[1] | |
# copy A into S, where the max slices are stored | |
S = A[:] | |
# instead of looping, I'll unroll the loop for simplicity | |
# so, at S[1], we either add the previous sum, or start over | |
# to decide that, we simply check the max between the element and the previous sum added | |
S[1] = max(S[1], S[1] + S[0]) | |
# S = [5, 3, ...] |
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 ubuntu | |
MAINTAINER Maz Jaleel <[email protected]> | |
# Install necessary tools to build Poco | |
RUN apt-get update && apt-get install -yq \ | |
unzip wget build-essential cmake \ | |
openssl libssl-dev \ | |
unixODBC unixODBC-dev odbc-postgresql |
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.HashMap; | |
import java.util.Map; | |
public class Driver { | |
static Map<String, Object> KeyValueStore = new HashMap<String, Object>(); | |
public static void main(String[] args) throws Exception { |