Skip to content

Instantly share code, notes, and snippets.

# 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
@jakobii
jakobii / CSharpInPowershell.ps1
Last active February 28, 2019 04:52
Embed C# In Powershell And Define Custom Interfaces!
# 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();
@jakobii
jakobii / Install_ubuntu_server_kiosk.md
Last active March 1, 2019 23:40
Temp User On Ubuntu 18.04 (still in the works!)

Minimal ubuntu server kiosk install

sudo apt-get install --no-install-recommends ubuntu-desktop
@jakobii
jakobii / impl_rust_distplay_example.rs
Last active February 25, 2019 07:17
implement fmt::Display on a struct in Rust
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
$SomeFunction = {
param(
[string]$Name
)
return 'Hi ' + $Name + '!'
}
$Somefunction.Invoke("Jacob")
# Hi Jacob!
@jakobii
jakobii / anonymous_powershell_functions_callback.ps1
Last active February 8, 2019 20:13
Anonymous Powershell Functions
# Our Custom Logic
$CustomErrorAction = {
param(
$TheError
)
# some custom logic
write-host $TheError -ForegroundColor 'red'
}
# A Contrived Function
@jakobii
jakobii / GitCredentials.md
Last active November 18, 2018 07:45
Permanently Persist Git Credentials

use curl credentials

replace with your info.

printf "machine <server>\nlogin <username>\npassword <password>\n" > ~/_netrc

example:

printf "machine github.com\nlogin foo\npassword bar\n" &gt; ~/_netrc
@jakobii
jakobii / AeriesMonthlyReports.sql
Last active March 27, 2019 19:36
Aeries Monthly Summary Report SQL Query
/*
NAME: AeriesMonthlyAttendanceReport
AUTH: Jacob Ochoa
DATE: 2018-11-15 12:02:14.497
VERSION: 0.2.1
DESCRIPTION:
This is a reverse engineered collection of calculated columns often
used in Aeries Attendance Reports. This Query can be used as a basis
for creating sql reports that are grouped similarly to some of aeries

Smarter Flasy checking in powershell

test-falsy is the function

Function Test-Falsy {
    param(
        # the value you would like to check for null
        [parameter(Mandatory = $true, ValueFromPipeline)]
@jakobii
jakobii / ConvertTo-DataTable.md
Last active May 2, 2018 23:37
ConvertTo-DataTable

ConvertTo-DataTable.psm1

FUNCTION  ConvertTo-DataTable {
    param(

        [string]
        $TableName,