Skip to content

Instantly share code, notes, and snippets.

View stevelippert's full-sized avatar

Steve Lippert stevelippert

View GitHub Profile
@stevelippert
stevelippert / randomBirthdays.js
Created September 13, 2021 16:48
A way to generate random birthdays in MongoDB shell.
db = db.getSiblingDB("e1_learn-qa");
//db.getCollection("profiles").find({});
var oldest = 24 * 60 * 60 * 1000 * 365 * 18;
var newest = 24 * 60 * 60 * 1000 * 365 * 5;
var randomDate = function () {
return new Date(Date.now() - (Math.random() * (oldest - newest)))
}
db.profiles.update(
{dob: {$exists: false}},
#!/bin/bash
logger "Installing Educator Base"
yum -y update
yum -y group install "Development Tools"
cd /home/edm/
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -i epel-release-latest-7.noarch.rpm
yum -y update
yum -y install nmap httpd wget rkhunter net-tools htop mod_ssl rsync screen perl-App-cpanminus perl-CPAN perl-XML-DOM perl-XML-Parser perl-XML-SAX perl-Template-Toolkit memcached imlib2 imlib2-devel mod_perl perl-String-CRC32 perl-Cache-Memcached perl-XML-LibXML libdbi-dbd-mysql perl-DBI perl-DBD-MySQL perl-DBD-SQLite perl-CGI perl-JSON perl-JSON-PP perl-JSON-XS perl-File-Slurp perl-Redis perl-DateTime perl-DateTime-Format-MySQL perl-DateTime-Format-Strptime perl-DateTime-TimeZone perl-Digest-SHA perl-Digest-SHA perl-Digest-SHA1 perl-Email-Simple perl-Encode perl-Excel-Writer-XLSX perl-File-Temp perl-HTML-Parser perl-HTML-Strip perl-HTTP-BrowserDetect perl-HTTP-Cookies perl-Crypt-CBC perl-Crypt-Rijndael perl-Net-OAuth perl-Net-XMPP perl-Parallel-ForkManager perl-SOAP
@stevelippert
stevelippert / S3 Bucket Policy - Public view.json
Created October 12, 2016 19:58
A simple Amazon S3 Bucket policy to allow public viewing of assets.
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"AddPerm",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::weatherstem/*"
]
}
@stevelippert
stevelippert / s3_upload.pl
Created October 12, 2016 19:22
An example of uploading a local file to S3.
#!/usr/bin/perl
use warnings;
use strict;
use Amazon::S3;
use vars qw/$OWNER_ID $OWNER_DISPLAYNAME/;
my $aws_access_key_id = 'YOUR AWS ACCESS KEY HERE';
my $aws_secret_access_key = 'YOUR AWS SECRET ACCESS KEY HERE';
@stevelippert
stevelippert / eventRender.js
Created June 3, 2015 16:19
FullCalendar.js - eventRender example
eventRender: function(event, element) {
if ( event.user ) {
element.find(".fc-title").append(" (" + event.user + ")");
}
//console.dir(element);
}
@stevelippert
stevelippert / fullCalendar_init.js
Last active May 17, 2018 06:44
FullCalendar.js - Example Initialization (http://fullcalendar.io)
calendar = $('#calendar').fullCalendar({
defaultView: "agendaWeek",
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
buttonText: {
today: "Today",
month: "Month",
@stevelippert
stevelippert / README.md
Last active August 29, 2015 14:19 — forked from hofmannsven/README.md
A simple help document for git.
@stevelippert
stevelippert / jquery_good_counting_matching_elements.js
Created February 27, 2015 16:25
An example of good counting of a matching element on the page
function countFlaggedQs(){
var fgC = $(".q-flag").children(".icon-flag").length,
fgT = ' flagged questions';
fgT = (fgC === 1) ? ' flagged question' : ' flagged questions';
$("#q_fg").html( fgC+' <i class="icon-flag" title="'+fgC+fgT+'"></i>' );
}
@stevelippert
stevelippert / jquery_bad_counting_matching_elements.js
Created February 27, 2015 16:21
An example of bad code to count the number of matching elements on a page.
function countFlaggedQs(){
var fgC = 0,
fgT = ' flagged questions';
$(".q-flag").each(function(){
if( $(this).children(".icon-flag").length ) {
fgC++;
}
});
fgT = (fgC === 1) ? ' flagged question' : ' flagged questions';
$("#q_fg").html( fgC+' <i class="icon-flag" title="'+fgC+fgT+'"></i>' );
<script charset="utf8" src="/libs/js/jquery.hotkeys.min.js"></script>
//When the ALT + N keys are pressed together, trigger the button click (as it has additional logic to process).
$(document).on("keydown", null, "alt+n", function(){
$("#BUTTON_ID").trigger("click");
});