Skip to content

Instantly share code, notes, and snippets.

View bramus's full-sized avatar

Bramus bramus

View GitHub Profile
@bramus
bramus / toledounzipper
Last active August 20, 2018 09:00
Toledo/Blackboard Gradebook Unzipper, Unix Style.
# toledounzip
# usage: toledounzip gradebook_B-KSL-JLW323-1314_LABO04\ \(LW6\ -\ LW7\).zip
function toledounzipmain() {
if (( $# != 1 )); then
echo "Please provide the name of a .zip file generated by Toledo";
else
if [ ! -f "$1" ]; then
echo "Invalid filename";
else
echo "=== Start unzipping main zip “$1”";
@bramus
bramus / paginationsequence.php
Last active February 2, 2023 16:01
Pagination Sequence Generator
<?php
/**
* Generate a sequence of numbers for use in a pagination system, the clever way.
* @author Bramus Van Damme <bramus@bram.us>
*
* The algorithm always returns the same amount of items in the sequence,
* indepdendent of the position of the current page.
*
* Example rows generated:
@bramus
bramus / gist:dba5c86510ab451598a2
Created September 10, 2014 14:08
cPanel mass delete forwarders
// WARNING! KNOW WHAT YOU ARE DOING! I AM NOT RESPONSIBLE IF YOU OR ANYONE (OR EVEN ANYTHING) ELSE MESSES THINGS UP!
(function() {
var popups = [];
$('a[href*="confirm.html"]').each(function(i) {
var url = $(this).attr('href').replace('confirm','');
popups[i] = window.open(url);
setTimeout(function() {
popups[i].close();
}, 2500);
});
@bramus
bramus / JavaCompileAndRun.sublime-build
Created September 23, 2014 18:15
Sublime Text Build System to compile and successively run a java source file.
// Installation: In Sublime select "Tools" > "Build System" > "New" and paste the contents of this gist in a file named `JavaCompileAndRun.sublime-build`
// Usage: In Sublime text select "Tools" > "Build System" > "JavaCompileAndRun". Hit CMD + B to execute it.
// @note: untested on Windows (but should work)
{
"windows": {
"shell": true,
"cmd": [
"javac", "$file", "&;",
"java", "$file_base_name"
@bramus
bramus / index.php
Created October 10, 2014 13:22
PHP Exception Typehinting
<?php
class DummyException extends Exception {
// ...
}
class Dummy {
public function __construct() {
throw new Exception('...');
}
@bramus
bramus / nmap.md
Last active August 29, 2015 14:07
Belgian banks vs. POODLE

(state at 2014-10-16)

Belfius

(SSL Labs Test: A-)

$ nmap --script +ssl-enum-ciphers -p443 www.belfius.be

Starting Nmap 6.40 ( http://nmap.org ) at 2014-10-16 21:18 CEST
Nmap scan report for www.belfius.be (212.63.233.37)
@bramus
bramus / gist:5b4f4733e543912a518f
Created November 4, 2014 19:50
OS X 10.10 Yosemite, Apache, MySQL, PHP 5.6, (MAMP) Homebrew Dev Setup
# From http://www.iyware.com/osx-yosemite-mamp-homebrew-development-setup/
# Install Homebrew
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
# Tap Repos
brew tap homebrew/dupes
brew tap homebrew/versions
@bramus
bramus / log1.crash
Created November 21, 2014 10:10
Last.fm 2.1.36 OS X Yosemite Crash Log
Process: Last.fm Scrobbler [793]
Path: /Applications/Last.fm.app/Contents/MacOS/Last.fm Scrobbler
Identifier: fm.last.Scrobbler
Version: 2.1.36
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Last.fm Scrobbler [793]
User ID: 501
Date/Time: 2014-10-23 00:30:33.816 +0200
<?php
namespace Psr\Router;
/**
* Describes a router instance
*
* ...
*/
interface RouterInterface
@bramus
bramus / instructions.md
Created February 9, 2015 21:02
Wampserver Virtual Vhosts

To make websites placed in C:\wamp\www\bramus.vandamme\labo01\public_html also available via http://labo01.bramus.vandamme.127.0.0.1.xip.io/ (next to http://localhost/bramus.vandamme/labo01/public_html) via Wampserver, follow these steps:

  1. Open C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf and remove the # before the line that reads #IncludeOptional "c:/wamp/vhosts/*"
  2. Create the file C:\wamp\vhosts\students.conf (see other file attached to this gist)
  3. Restart wampserver.