Skip to content

Instantly share code, notes, and snippets.

function generalSymEmail() {
const recipient = 'sym@middlebury.edu';//sym@middlebury.edu
const subject = 'Spring Symposium Application'
const body = betterAllData();
MailApp.sendEmail({
to: recipient,
replyTo: 'sym@middlebury.edu',
name: 'Spring Student Symposium',
subject: subject,
htmlBody: body,
<div class="kl_flex_columns_wrapper" style="margin-bottom: 30px;">
<div class="kl_flex_column">
<div class="kl_flex_columns_wrapper">
<div class="kl_flex_column"><img id="1445356" style="border-radius: 10px;" src="https://middlebury.instructure.com/courses/9255/files/1445356/preview" alt="One of your favorite teachers.jpg" data-api-endpoint="https://middlebury.instructure.com/api/v1/courses/9255/files/1445356" data-api-returntype="File" /></div>
<div class="kl_flex_column">
<h2 style="border-bottom: 1px solid #efefef;">Title</h2>
<h3>Date</h3>
</div>
</div>
</div>
@woodwardtw
woodwardtw / dooo_lastlogins.py
Created June 22, 2021 19:01
/root/last_logins_py.py
#!/usr/bin/python
#
# Imports the libraries
import os, time, yaml
#
# Creates the array to store data
user_data = []
user_data.append("LAST LOGIN DATE, USERNAME, EMAIL, PRIMARY DOMAIN, DISK USAGE, START DATE")
#
# Gets info on the accounts from the WHM API and cPanel last login logs
function getNames(){
var first = [];
var last = [];
const names = document.querySelectorAll('h3')
names.forEach(function(name){
//console.log(name.innerText)
let split = name.innerText.split(", ");
first.push(split[1]);
<?php
$user = "root";
$token = "YOURTOKENHERE";
$query = "https://YOURIP:YOURPORT/json-api/listaccts?api.version=1";
//json-api/listaccts -- generic info, disk usage, start date, domain,
//get_disk_usage -- disk usage obviously
//showbw -- bandwidth
@woodwardtw
woodwardtw / app.js
Last active June 3, 2021 14:37
updated/expanded dlinq slack app
const { App } = require('@slack/bolt');
const WPAPI = require( 'wpapi' );//add in http://wp-api.org/node-wpapi
// Initializes your app with your bot token and signing secret
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET
});
foreach ($data['custom_fields'] as $key => $value) { //first foreach loop*****************if the rest is gone does this work alone?
if (empty($data['custom_fields'][$key])){
unset($data['custom_fields'][$key]);
}
}
if (!empty($data['levels'])){
$fullPath = IHC_PATH . 'public/views/membership_card.php';
$searchFilename = 'membership_card.php';
const { App } = require('@slack/bolt');
const WPAPI = require( 'wpapi' );//add in http://wp-api.org/node-wpapi
// Initializes your app with your bot token and signing secret
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET
});
@woodwardtw
woodwardtw / emailClean.js
Created April 20, 2021 18:39
little google custom function
function emailClean(input) {
let email = input.split("@")
let clean = email[0]
return clean;
}
@woodwardtw
woodwardtw / weather_example_script.js
Last active April 20, 2021 19:10
Example function in Google Script using https://openweathermap.org/current API
function otherWeather(){
const ss = SpreadsheetApp.getActiveSpreadsheet();//gets your spreadsheet
const sheet = ss.getSheetByName('APIData');//gets the sheet in your spreadsheet with this name
const apiUrl = 'http://api.openweathermap.org/data/2.5/weather?zip=05753,us&appid=YOUR_API_KEY&units=imperial';//goes to the API
const response = UrlFetchApp.fetch(apiUrl);//gets the API data
const json = JSON.parse(response.getContentText());//treat it as json
const data = [json.dt,json.weather[0].main, json.main.temp, json.wind.speed];//get the data we want from the API
sheet.appendRow(data);//write it to the sheet
}