This file contains 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 | |
echo "Getting current DNS servers, this takes a couple of seconds" | |
/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command ' | |
$ErrorActionPreference="SilentlyContinue" | |
Get-NetAdapter -InterfaceDescription "Cisco AnyConnect*" | Get-DnsClientServerAddress | Select -ExpandProperty ServerAddresses | |
Get-NetAdapter | ?{-not ($_.InterfaceDescription -like "Cisco AnyConnect*") } | Get-DnsClientServerAddress | Select -ExpandProperty ServerAddresses | |
' | \ | |
awk 'BEGIN { print "# Generated by vpn-fix on", strftime("%c"); print } { print "nameserver", $1 }' | \ |
This file contains 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 sys | |
import os | |
from PIL import Image | |
from multiprocessing import Process, Queue, cpu_count | |
TILE_SIZE = 100 | |
TILE_MATCH_RES = 25 | |
ENLARGEMENT = 10 |
This file contains 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
{ | |
"dir" : "ltr", | |
"lang" : "bn", | |
"name" : "গুরুচন্ডালি", | |
"scope" : "/", | |
"display" : "browser", | |
"start_url" : "https://www.guruchandali.com/", | |
"short_name" : "গুরুচন্ডালি", | |
"theme_color" : "transparent", | |
"description" : "", |
This file contains 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 cv2 # OpenCV | |
# 1. Load the original image | |
img = cv2.imread('paris.jpg') | |
# Convert the image to grayscale | |
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
# 2. Create BRISK algorithm | |
# OpenCV default threshold = 30, octaves = 3 | |
# Using 4 octaves as cited as typical value by the original paper by Leutenegger et al. |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>DQ Test</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
This file contains 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
func fetchConfig() { | |
var expirationDuration: Double = 3600 | |
// If in developer mode cacheExpiration is set to 0 so each fetch will retrieve values from | |
// the server. | |
if (self.remoteConfig.configSettings.isDeveloperModeEnabled) { | |
expirationDuration = 0 | |
} | |
// cacheExpirationSeconds is set to cacheExpiration here, indicating that any previously | |
// fetched and cached config would be considered expired because it would have been fetched |
This file contains 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
func imagePickerController(_ picker: UIImagePickerController, | |
didFinishPickingMediaWithInfo info: [String : Any]) { | |
picker.dismiss(animated: true, completion:nil) | |
guard let uid = FIRAuth.auth()?.currentUser?.uid else { return } | |
// if it's a photo from the library, not an image from the camera | |
if #available(iOS 8.0, *), let referenceURL = info[UIImagePickerControllerReferenceURL] { | |
let assets = PHAsset.fetchAssets(withALAssetURLs: [referenceURL as! URL], options: nil) | |
let asset = assets.firstObject | |
asset?.requestContentEditingInput(with: nil, completionHandler: { [weak self] (contentEditingInput, info) in |
This file contains 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
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
// Dequeue cell | |
let cell = self.clientTable .dequeueReusableCell(withIdentifier: "tableViewCell", for: indexPath) | |
// Unpack message from Firebase DataSnapshot | |
let messageSnapshot: FIRDataSnapshot! = self.messages[indexPath.row] | |
let message = messageSnapshot.value as! Dictionary<String, String> | |
let name = message[Constants.MessageFields.name] as String! | |
if let imageURL = message[Constants.MessageFields.imageURL] { | |
if imageURL.hasPrefix("gs://") { | |
FIRStorage.storage().reference(forURL: imageURL).data(withMaxSize: INT64_MAX){ (data, error) in |
This file contains 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
deinit { | |
self.ref.child("messages").removeObserverWithHandle(_refHandle) | |
} | |
func configureDatabase() { | |
ref = FIRDatabase.database().reference() | |
// Listen for new messages in the Firebase database | |
_refHandle = self.ref.child("messages").observe(.childAdded, with: { [weak self] (snapshot) -> Void in | |
guard let strongSelf = self else { return } |
This file contains 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
override func viewDidAppear(_ animated: Bool) { | |
if let user = FIRAuth.auth()?.currentUser { | |
self.signedIn(user) | |
} | |
} | |
@IBAction func didTapSignIn(_ sender: AnyObject) { | |
// Sign In with credentials. | |
guard let email = emailField.text, let password = passwordField.text else { return } | |
FIRAuth.auth()?.signIn(withEmail: email, password: password) { (user, error) in |
NewerOlder