Skip to content

Instantly share code, notes, and snippets.

View kenaniah's full-sized avatar

Kenaniah Cerny kenaniah

  • Rancho Palos Verdes, CA
View GitHub Profile
fswatch -r . --exclude "/target/" -o | xargs -n1 -I{} cargo test
@kenaniah
kenaniah / word_finder.rb
Last active August 5, 2017 23:28
Capitals Word Finder
#!/usr/bin/env ruby
require 'colorize'
require 'sequel'
DB = Sequel.connect "postgres:///ospd"
# Helper method
class String
def counts
@kenaniah
kenaniah / versioning.rb
Created June 15, 2017 23:47
Versioning
module Versioned
module V0
def method_missing name
puts "#{name} not found".red
end
end
module V1
def foo
puts "foo 1"
@kenaniah
kenaniah / sequel_cti_isssue.rb
Created April 20, 2017 20:08
Sequel CTI Association Filtering Issue
class Related < Sequel::Model; end
class Parent < Sequel::Model
plugin(
:class_table_inheritance,
key: :type,
table_map: {
:Child => :children
}
)
@kenaniah
kenaniah / react-template.jsx
Last active January 5, 2016 01:19
React Template
const reactComponent = React.createClass({
mixins: [],
propTypes: {},
// Initial defaults
//getDefaultProps: function(){},
//getInitialState: function(){},
// Property change lifecycle
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test Page</title>
</head>
<style>
HTML, BODY, MAIN {
width: 100%;
height: 100%;
@kenaniah
kenaniah / setup.sh
Created November 3, 2015 16:01
Laptop Onboarding
#!/bin/bash
echo 'alias ll="ls -l"' >> /etc/profile
echo 'alias morningbrew="brew update && brew upgrade --all && brew cleanup && brew prune && gem update"' >> /etc/profile
#!/bin/bash
processors=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l)
# Usage information
if [ $# -ne 2 ]
then
echo "Usage: $0 <source_file> <dbname>"
echo
echo "This script will restore the requested database from the given source file."
#!/bin/bash
# This file is being maintained by Puppet.
# DO NOT EDIT
# Usage information
if [ $# -ne 2 ]
then
echo "Usage: $0 <original_name> <new_name>"
echo
# Connect to Microsoft Online as admin
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "admin@contoso.onmicrosoft.com",(Get-Content admin.pass | ConvertTo-SecureString)
Connect-MsolService -Credential $cred
# Connect to Office365 as admin
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $cred -Authentication Basic -AllowRedirection
Set-ExecutionPolicy unrestricted
Import-PSSession $session