sudo apt-get install --no-install-recommends ubuntu-desktop
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
$SomeFunction = { | |
param( | |
[string]$Name | |
) | |
return 'Hi ' + $Name + '!' | |
} | |
$Somefunction.Invoke("Jacob") | |
# Hi Jacob! |
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
use std::fmt; | |
// IPv4 struct is just a tuple of u8's. | |
// just an arbitrary, but realistic example... | |
struct IPv4(u8, u8, u8, u8); | |
// declare the impl block for out IPv4 struct. | |
impl fmt::Display for IPv4 { | |
// this is the function signature the fmt::distplay trait is looking for. | |
// https://doc.rust-lang.org/std/fmt/trait.Display.html |
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
# here is our custom interface. hopefully powershell will support creating | |
# interfaces natively soon. this is a simple example and is not ment to | |
# teach you c# syntax. sufice it to say an interface is a *contract*. an | |
# interface defines what methods and properties a class should have. | |
# interfaces allow you to contrain function parameters to only type that | |
# fullfill the *contract*. this is illistrated in the code below. | |
$CSharpCode = @" | |
public interface IFoo | |
{ | |
void Bar(); |
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
# variables | |
DISTRIB_CODENAME = bionic | |
cert_dir = /etc/ssl/certs/ | |
# install | |
# https://rethinkdb.com/docs/install/ubuntu/ | |
source /etc/lsb-release && echo "deb https://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list | |
wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install rethinkdb |
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
package main | |
import ( | |
"crypto/tls" | |
"crypto/x509" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" |
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
package main | |
import ( | |
"database/sql" | |
"encoding/json" | |
"fmt" | |
"log" | |
_ "github.com/denisenkom/go-mssqldb" | |
) |
Table constraints can include multiple columns. The trick to getting this right is to join each column by their constraint ordinal positions. If you don't join correctly your script will blow up with duplicate rows 😥 whenever a table has multiple columns in a unique constraint.
This may be helpful in understanding what these tables do.
information_schema.table_constraints
- lists all table constraints
- explains constraint types
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
//https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding | |
func writeOptimizedHttpResponse(w http.ResponseWriter, r *http.Request, b []byte, contentType string) { | |
w.Header().Set("Content-Type", contentType) | |
encodings := r.Header.Get("Accept-Encoding") | |
switch { | |
case strings.Contains(encodings, "gzip"): | |
w.Header().Set("Content-Encoding", "gzip") |
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
# This is a scriptblock that will be invoked on the remote computer. This is | |
# just dummy code that gets the computers hostname from the global built in | |
# eniorment variable $env. | |
$RemoteTask = { | |
param( | |
[datetime]$Start | |
) | |
# pause remote script execition until the specified start time. | |
# you can use this to loosely sync jobs execution. |