Skip to content

Instantly share code, notes, and snippets.

View whisperity's full-sized avatar
🍃
C++Elf

whisperity

🍃
C++Elf
View GitHub Profile
@whisperity
whisperity / canvas-audit.py
Created February 14, 2022 18:08 — forked from mcserep/canvas-audit.py
Canvas LMS script to automatically check the quiz audit logs and filter out students who interrupted the quiz too many times.
"""MIT License
Copyright (c) 2021-2022 Mate Cserep, https://mcserep.web.elte.hu/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@whisperity
whisperity / TypedKeyValuePair_Tokn_Stor.php
Last active December 12, 2015 08:48
This just happened.
<?php
class TypedKeyValuePair_Tokn_Stor
{
private $_key;
private $_value;
public function __construct(&$key, &$value)
{
$this->setKey(&$key);
@whisperity
whisperity / daemon.sh
Last active March 15, 2019 01:05
Start arbitrary shell script as a background daemon from init.d
#!/bin/sh
### BEGIN INIT INFO
# Provides: scriptname
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Script short description
# Description: Starts/Stops the script
@whisperity
whisperity / prettyvar.php
Created July 24, 2012 16:05
Output PHP variables in a prettier format for human-readable dumping
function prettyVar($variable = NULL)
{
return str_replace(array("\n"," "),array("<br>","&nbsp;"), var_export($variable,true))."<br>";
}
@whisperity
whisperity / mysql.md
Created July 24, 2012 11:31 — forked from salathe/mysql.md
Comment for mysql_* users [now as header into answers]

Warning:

Please, don't use mysql_* functions to write new code. They are no longer maintained and the community has begun the deprecation process. See the red box?

Instead, you should learn about prepared statements and use either PDO or [MySQLi][manual-mysqli]. [This article][choosing-an-api] should give some details about deciding which API to use. For PDO, here is a [good tutorial][pdo-tutorial].