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 UIKit | |
import PlaygroundSupport | |
class Rectangle:UIView{ | |
override func draw(_ rect: CGRect) { | |
let path = UIBezierPath(rect: rect) | |
path.move(to: CGPoint(x:0,y:rect.height)) | |
path.addLine(to: CGPoint(x:rect.width/2,y:rect.height/1.4)) |
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 MapKit | |
import SwiftUI | |
import PlaygroundSupport | |
struct ContentView:View{ | |
var body:some View{ | |
VStack{ | |
Text("Hello, World") | |
MapView() |
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 MapKit | |
import SwiftUI | |
import PlaygroundSupport | |
struct ContentView:View{ | |
var body:some View{ | |
VStack{ | |
Text("Hello, World") | |
MapView() |
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.Text; | |
using RabbitMQ.Client; | |
using RabbitMQ.Client.Events; | |
namespace SBRabbit{ | |
class Program{ | |
static void Usage(){ | |
Console.WriteLine("SBRabbit <publish|susbscribe>"); | |
} |
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 AddSSLBinding($fqdn,$ip,$thumbprint){ | |
$cert = Get-ChildItem Cert:\LocalMachine\My\$($thumbprint) | |
New-WebBinding -Name $fqdn -IPAddress "$($ip)" -Port 443 -Protocol "https" -HostHeader $fqdn | |
$bind = Get-WebBinding -Name $fqdn -Protocol https | |
$bind.AddSslCertificate($cert.GetCertHashString(), "my") | |
} | |
#Usage Example | |
AddSSLBinding "test.domain.com" "10.0.0.1" "12344979A469750712B5EAC6168D85EC02E053FC" |
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 AddHostEntry($fqdn){ | |
$Pattern = '^(?<IP>\d{1,3}(\.\d{1,3}){3})\s+(?<Host>.+)$' | |
$File = "$env:SystemDrive\Windows\System32\Drivers\etc\hosts" | |
$Entries = @() | |
$found = $false | |
(Get-Content -Path $File) | ForEach-Object { | |
If ($_ -match $Pattern) { | |
#Write-Host "$($Matches.IP),$($Matches.Host)" -ForegroundColor Green |
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 AddAttribute([System.Xml.XmlNode] $node, $name , $value){ | |
$attrib = $node.OwnerDocument.CreateAttribute($name) | |
$attrib.Value = $value | |
$node.Attributes.Append($attrib) | |
} | |
function AddConnectionString($webconfigFile, $name, $connectionString){ | |
[xml]$document = Get-Content $webconfigFile | |
$configElement = $document.SelectSingleNode("configuration") | |
$connectionStringsElement = $configElement.SelectSingleNode("connectionStrings") |
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
hdiutil create -o /tmp/mojave.cdr.dmg -size 7130m -layout SPUD -fs HFS+J | |
hdiutil attach /tmp/mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build | |
sudo /Applications/Install\ macOS\ 10.14\ Beta.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build | |
hdiutil detach /Volumes/Install\ macOS\ 10.14\ Beta | |
mv /tmp/mojave.cdr.dmg ~/Desktop/InstallSystem.dmg | |
hdiutil convert ~/Desktop/InstallSystem.dmg -format UDTO -o ~/Desktop/mojave.iso | |
mv ~/Desktop/mojave.iso.cdr ~/Desktop/mojave.iso | |
rm ~/Desktop/InstallSystem.dmg |
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
#Now lets export to .mlmodel format | |
import coremltools | |
coreml_model = coremltools.converters.sklearn.convert(clf,['Sepal.Length','Sepal.Width','Petal.Length','Petal.Width'],'Species') | |
coreml_model.author = 'Gavi Narra' | |
coreml_model.license = 'BSD' | |
coreml_model.short_description = 'Predicts the iris species provided the sepal length, sepal width, petal length and petal width.' | |
coreml_model.save('iris.mlmodel') |
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 sklearn import datasets | |
from sklearn.ensemble import RandomForestClassifier | |
import coremltools | |
iris = datasets.load_iris() | |
clf = RandomForestClassifier() | |
clf.fit(iris.data, iris.target_names[iris.target]) | |
#Test to see if it is working correctly | |
print(list(clf.predict(iris.data[:3]))) | |
print(list(clf.predict([[ 5.1,3.5,1.4,0.2]]))) |
NewerOlder