Skip to content

Instantly share code, notes, and snippets.

@JamesOBenson
JamesOBenson / gist:30a4ddcc789b76fe9184a3eb3d756537
Created July 13, 2016 13:41
R code to connect/disconnect, download & save data from remote SQL database
TO CONNECT:
library("RPostgreSQL")
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname="postgres",host="dataport.pecanstreet.org",port=5434,user="username",password="password")
GETS EVERYTHING FROM THIS TABLE:
myTable <- dbReadTable(con, c("university", "electricity_egauge_15min"))
SELECT CERTAIN VALUES FROM A TABLE:
data <- dbGetQuery(con, "SELECT * from university.weather WHERE localhour BETWEEN '01-01-2015' AND '02-01-2015'")
@JamesOBenson
JamesOBenson / gist:4bce1e61e4d02524862cd47732a2159d
Created August 19, 2016 04:11
R basic parameters (par) to help create a great looking boxplot....
load("some_data.RData")
png(file=output.png",width=1200,height=1200)
par(cex.main = 1.5, mar = c(5, 6, 4, 5) + 0.1, mgp = c(3.5, 1, 0), cex.lab = 2.0,
font.lab = 2, cex.axis = 2.0, bty = "n", las = 1, family="serif")
boxplot(formula~categories,
data=mydata,
ylim=c(0,100),
cex.out = 1,
col="blue",
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBIHx2g+BAfUJDgV7pToJWN0rLytiaKUA3hq9pLIJm1k James.Benson@utsa.edu
@JamesOBenson
JamesOBenson / Generating a secure SSH Key and commands
Last active October 16, 2023 06:45
SSH Generation and commands.
ssh-keygen
-t ed25519 - for greatest security (bits are a fixed size and -b flag will be ignored)
-t rsa - for greatest portability (key needs to be greater than 4096 bits)
-t ecdsa - faster than RSA or DSA (bits can only be 256, 284, or 521)
-t dsa - DEEMED INSECURE - DSA limted to 1024 bit key as specified by FIPS 186-2, No longer allowed by default in OpenSSH 7.0+
-t rsa1 - DEEMED INSECURE - has weaknesses and shouldn't be used (used in protocol 1)
-b 4096 bit size
-a 500 rounds (should be no smaller than 64, result in slower passphrase verification and increased resistance to brute-force password cracking)
-C "First.Last@somewhere.com" comment..
ping range of IP's
for x in {100..125}; do ping -c 1 -W 100 10.3.100.$x | grep 'time='; done
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAEAQDGYSdETkHMGxfRcAjUA+sjKUkYfPi5E40J2U9597T9gTiaJiFjWK4EhARupMgvW37+tPveybZ9BXMwyzeqqo8A+TQlsLoU1wUALFmx1gwZBv5JwAlrRLRVjrgJiu+BIcGV4gdhVnhewSSkaw8hHUWB8xyp6TDTDmk3U+YxVARH75ZpCD6nBrpN4QdAOeyiQefR5E5IjNDVkfOdJBjT+0gIT9uwQTLP9sORNhp8KP8ZkdcX5hFaW0X/P0mgyjEQW9WMa/rIfLx6z/1rPtcfDj9GF7keXaN7KYBVipEOcUUTWkxizH31Zp+TEbA7R/4s01b6WTW+kmiQ2xNHalF/EQl7ArSFLDeLeqCxbCy01O7EVLK5eanP996IVwxLD3bS9CB6P0EBGGNe0po5ZNCuvk7qhazSP8Bkf/X06HYSL0jMWH5AIhXrcNmplc+C3oU6DMrPVHScO8Y7jGwHEBZendWJ4oDsMgW/9wtR6glX4UTE5fYFvpL1oB7xbzTnyLWY/XAOr9oZcM0brfhSN0t7zw6ffzkIXAn1rT1sRoZg2oQHwS6sp3DEYRuSS4VTZedziTRdtmXb4jCyD2gDmcpzFO0HO8dofQG+LNrAcDhCiERN3iGcDT1LtKIQMHL+rN0OTct34swOmVKJaCxCBWHi+pgGM0pKo0dzZfOYUkU8ul7OdnpUI54gUkkgGBpviA5jtzNzKcs6KKjX2ma4iklaQMc2DDJ//yjpO53Tm9WyEgUdyWJD37I+khLf3PP+u9VpG2b755tk25sd5z4kohifLN6IO3ANcJwVJ+tOUunVPn4B3qjqcGvcMhU9xOZShdwP5aO0oq4qS3dHsHe1eKVgyZSN/UZsaH17EZRULqe1dC6/0mg4KdJS/oof8czYG8U44hO+38+rzseej5h3TV+HkYPXmCQ7J75boiNCqccGrpAMX+B/8aGjDOJD4l8bX92dZu5nTnvLhwAk1PcVsBHgRqVjg3d6
@JamesOBenson
JamesOBenson / README.md
Created November 30, 2016 22:04 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

Step 1: Create Volume in OpenStack (Can be completed in GUI)
CLI:
cinder create SIZE_IN_GB --display-name NAME
cinder create 10 --display-name mystorage
cinder list
Step 2: Attach volume to Openstack instance (Can be completed in GUI)
CLI:
nova volume-attach INSTANCE_ID VOLUME_ID auto
nova volume-attach myhost f14e47ab-18f6-4f85-bd17-a3f63a38d609 auto
Source: http://hints.macworld.com/article.php?story=20100113142633883
To have tab to complete from .ssh/config file in MacOS (Verified on MacOS 10.12.4),
vi ~/.bash_profile (New file)
# Copy and paste this line
complete -o default -o nospace -W "$(/usr/bin/env ruby -ne 'puts $_.split(/[,\s]+/)[1..-1].reject{|host| host.match(/\*|\?/)} if $_.match(/^\s*Host\s+/);' < $HOME/.ssh/config)" scp sftp ssh
source ~/.bash_profile
@JamesOBenson
JamesOBenson / json misc
Created September 6, 2017 15:20
Random json examples.
## Python 2.7
>>> import json
>>> import sys
>>>
>>> #load the data into an element
... data={"test1" : "1", "test2" : "2", "test3" : "3"}
>>>
>>> #dumps the json object into an element
... json_str = json.dumps(data)