Skip to content

Instantly share code, notes, and snippets.

@iley
iley / part1.awk
Last active December 4, 2021 07:11
Advent of Code Day 4
function has_won(board, x, y, winning_row, winning_col) {
for (y = 1; y <= height; y++) {
winning_row = 1
for (x = 1; x <= height; x++) {
if (board[x, y] != -1) {
winning_row = 0
break
}
}
@iley
iley / part1.awk
Created December 3, 2021 08:57
Advent of Code Day 3
BEGIN { FS="" }
{
for (i = 1; i <= NF; i++) {
if ($i == 1) ones[i]++
else zeroes[i]++
}
}
END {
@iley
iley / awsp.sh
Created January 17, 2020 09:46
Script to switch AWS between profiles configured with SSO
#!/bin/bash
set -e
new_profile="$1"
if [[ -z "$new_profile" ]]; then
# Just list existing profiles.
profiles=$(cat ~/.aws/config | perl -ne 'print if s/\[profile\s+(\S+)\]/$1/')
default_account=$(aws configure get sso_account_id --profile default)
for profile in $profiles; do
#include <LiquidCrystal.h>
#include <Wire.h>
const int speakerPin = 9;
const int lampPin = 8;
const int controlButtons = 3;
const int controlButtonPins[] = { 12, 13, 11 };
const int playerButtons = 6;
const int playerButtonPins[] = { 5, 4, 3, 2, 1, 0 };
import random
from collections import defaultdict
class LoadBalancer:
def __init__(self, targets, probabilities):
self._targets = targets.copy()
n = len(targets)
self._n = n
p = probabilities.copy()
self._alias = [0] * n
@iley
iley / Vagrantfile
Last active July 18, 2018 11:09
basic vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<-SCRIPT
echo Provisioning...
sed 's/^session.*pam_motd/# &/' -i /etc/pam.d/{sshd,login}
sed 's/^AcceptEnv LANG/# &/' -i /etc/ssh/sshd_config
sudo apt update
SCRIPT
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# ansible master
config.vm.define :finn do |finn|
finn.vm.box = "precise32"
finn.vm.hostname = "finn"
finn.vm.network :private_network, ip: "192.168.33.10"
finn.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "512"]
" plugins
Bundle 'Lokaltog/vim-powerline'
Bundle 'ervandew/supertab'
Bundle 'exu/pgsql.vim'
Bundle 'fatih/vim-go'
Bundle 'honza/vim-snippets'
Bundle 'hynek/vim-python-pep8-indent'
Bundle 'garbas/vim-snipmate'
Bundle 'gcmt/taboo.vim'
Bundle 'git://git.wincent.com/command-t.git'
function _prompt_pwd {
local max_len=50
local dir=$(pwd|sed -e "s#^$HOME#~#")
if [ ${#dir} -gt $max_len ]; then
local cut=$(expr ${#dir} - $max_len + 3)
dir="...${dir:$cut}"
fi
echo $dir
}
diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp
index 5b3f1e7..a7829c7 100644
--- a/src/modules/extra/m_ldapauth.cpp
+++ b/src/modules/extra/m_ldapauth.cpp
@@ -104,6 +104,7 @@ class ModuleLDAPAuth : public Module
std::string username;
std::string password;
std::string vhost;
+ std::string group;
std::vector<std::string> whitelistedcidrs;