Skip to content

Instantly share code, notes, and snippets.

@rivernate
rivernate / bash_cheat.sh
Created May 5, 2021 16:54
Bash Script cheat sheet
#!/usr/bin/env bash
## Font weight
bold=$(tput bold)
normal=$(tput sgr0)
## Font colors
red=$'\e[1;31m'
grn=$'\e[1;32m'
end=$'\e[0m'
### Keybase proof
I hereby claim:
* I am rivernate on github.
* I am rivernate (https://keybase.io/rivernate) on keybase.
* I have a public key ASCPj-FwlRUQz0-rONm_X0MdxzfHaui2e2ybMekNIr02Vwo
To claim this, I am signing this object:
<?xml version="1.0" encoding="UTF-8"?><cartridge_basiclti_link xmlns="http://www.imsglobal.org/xsd/imslticc_v1p0" xmlns:blti="http://www.imsglobal.org/xsd/imsbasiclti_v1p0" xmlns:lticm="http://www.imsglobal.org/xsd/imslticm_v1p0" xmlns:lticp="http://www.imsglobal.org/xsd/imslticp_v1p0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0p1.xsd http://www.imsglobal.org/xsd/imslticm_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd http://www.imsglobal.org/xsd/imslticp_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd">
<blti:title>IMS Certification Suite</blti:title>
<blti:launch_url>https://apps.imsglobal.org/lti/cert/tc/tc_tool.php?x=With%20Space&amp;y=yes</blti:launch_url>
<blti:extensions platform="canvas.instructure.com">
<lticm:option
@rivernate
rivernate / reboot_to_linux.bat
Last active March 19, 2017 17:39
reboot to other linux
@echo off
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit)
bcdedit /set {fwbootmgr} bootsequence {uuid}
shutdown /r /t 0

Keybase proof

I hereby claim:

  • I am rivernate on github.
  • I am rivernate (https://keybase.io/rivernate) on keybase.
  • I have a public key ASD8cYT3yNwGh8X6K7KYjdhCSP9zxktUMXVUdX2ynilAUwo

To claim this, I am signing this object:

Canvas File Upload Example
require 'simple_oauth'
SimpleOAuth::Header::ATTRIBUTE_KEYS << :body_hash unless SimpleOAuth::Header::ATTRIBUTE_KEYS.include? :body_hash
def self.validate(header, url, secret)
o = SimpleOAuth::Header.new(:post, url, {}, SimpleOAuth::Header.parse(header).merge({consumer_secret: secret}))
puts o.send(:signature)
puts o.send(:signature_base)
#puts o.send(:secret)
puts o.valid?()
o
require 'httparty'
require 'httmultiparty'
access_token = ""
domain = ""
course_id = ""
assignment_id = ""
file_path = ''
api_endpoint = "#{domain}/api/v1/courses/#{course_id}/assignments/#{assignment_id}/submissions/self/files"
file = File.new(file_path)
@rivernate
rivernate / auburn.rb
Created January 29, 2013 00:56
Auburn report
module Canvas::AccountReports
class Auburn
include Api
include Canvas::ReportHelpers::DateHelper
def self.course_status_csv(account_report)
Auburn.new(account_report).course_status
end
def initialize(account_report)
@rivernate
rivernate / auburn_reports_spec.rb
Created January 29, 2013 00:53
Auburn report spec
require File.expand_path(File.dirname(__FILE__) + '../../../account_reports/spec_canvas/reports_helper')
describe "Auburn custom reports" do
it "should run course status report" do
Notification.find_or_create_by_name("Report Generated")
Notification.find_or_create_by_name("Report Generation Failed")
@account = Account.default
sub_account = Account.create(:parent_account => @account, :name => 'English')