Skip to content

Instantly share code, notes, and snippets.

<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#

Reeks 1

Examen

Examen PERL is aan de PC, ongeveer 5 uur de tijd en is 1 grote vraag.

Vergelijken strings

Vergelijken strings is met de keywords "eq", "ne", "le", "lt", "ge", "gt"

vb:

@XavierGeerinck
XavierGeerinck / oef_propertycache.pl
Created January 5, 2016 09:54
Property Cache Exercise (Active Directory)
# Laad CN=Administrator,CN=Users,DC=iii,DC=hogent,DC=be in en vraag volgende attributen op met GetEx:
# 'cn', 'allowedAttributes', 'mail', 'canonicalName', 'objectClass'
# Indien dit niet lukt, vang dit op en probeer met een andere methode
use Win32::OLE;
use Win32::OLE::Const 'Active DS Type Library';
use Win32::OLE::Variant;
# Error codes, zie AD Service Interfaces Reference ADSI Error Codes / Generic ADSI Error Codes
my %E_ADS = (
@XavierGeerinck
XavierGeerinck / ex_ldapquery.pl
Created January 5, 2016 18:33
Exercise LDAP Query (Active Directory)
# Toon het aantal leden (members) van alle groepen (gebruik een LDAP-query om alle groepen op te sporen)
# Lees de naam in van 1 groep en geef een overzicht van de leden van deze groep
# dsquery: dsquery.exe * -s satan.hogent.be -u "Xavier Geerinck" -p "Xavier Geerinck"
# -filter "(&(objectcategory=group)(member=*))" -scope subtree
#
# De dsquery gaat bij object category zoeken achter groups en zorgen dat deze members heeft
use Win32::OLE;
use Win32::OLE::Const 'Active DS Type Library';
@XavierGeerinck
XavierGeerinck / prefix_function.js
Created January 26, 2016 18:30
Prefix Function Implemented Using Javascript (used in Knuth Morris Pratt, ...)
/**
* We start by setting element [0] on 0
* Check every time of the index of arr found by getting prefix[i] is the same,
* if so do +1 else start over from 0
**/
function calculate_prefix(patternArr) {
var prefix = [];
// First index is 0
prefix[0] = 0;
@XavierGeerinck
XavierGeerinck / dynamic_programming_longest_common_subsequence_LCS.js
Last active August 27, 2016 14:59
Dynamic Programming - Longest Common SubSequence (LCS)
/**
* @author: Xavier Geerinck
* @title: Longest Common Subsequence
* @subtitle: This algorithm finds the longest common subsequence in 2 different strings
* @method:
* To find the longest common subsequence, we will create a matrix with at the top the first string and at the left the second string.
* 1. Set length of the LCS = 0
* 2. From left to right, top to bottom, loop over the matrix
* i. If the characters are equal at i, j --> do LCS + 1
* ii. If the characters are not equal at i,j --> take max(leftVal, topVal)
@XavierGeerinck
XavierGeerinck / algorithms_string_encoding_huffman.js
Created August 28, 2016 09:13
Algorithms String Encoding HuffmanCode
/**
* @author: Xavier Geerinck
* @title: Huffman encoding
* @subtitle: This algorithm compresses a string it's binary representation
* @method:
* 1. Create a table for each character with their "frequence of occurence"
* 2. Create leaf element of each character and put it in a priority queue (the priority is based on the "frequence of occurence" for that character)
* 3. As long as the queue >= 2 elements
* i. Remove 2 nodes
* ii. Make a new node with the 2 children the 2 removed nodes. This new node has the sum of the priorities. (biggest child left, smallest right).
@XavierGeerinck
XavierGeerinck / heuristics_evolutionary_computation.js
Last active August 30, 2016 08:44
Heuristics - Evolutionary Computation
/**
* @author: Xavier Geerinck
* @title: Heuristics - Evolutionary Computation
* @subtitle:
* @method:
* 1. Create a population
* 2. Check the fitness of the individuals of the population
* 3. As long as termination condition not met, continue
* i. Recombine: take 2 parents and combine them
* ii. Mutate: For the new child, change some properties based on a mutation parameter
@XavierGeerinck
XavierGeerinck / taboolist_word_finder.md
Created October 4, 2016 08:26
Finds taboo words in a academic paper / thesis and gives recommendations to change

Info

This utility finds taboo words in .tex files and gives a recommendation of how to replace them for a correct academic/thesis writestyle. All these recommendations can be found at: https://www.scribbr.com/academic-writing/taboo-words/

Usage: node taboolist_word_finder.js <WordListFile> <DirWithTexFiles>

taboolist_word_finder.js

// Make sure we got a filename on the command line.
if (process.argv.length < 3) {
	console.log('Usage: node ' + process.argv[1] + ' <Wordlist> <DirWithFiles>');