This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { FS="" } | |
{ | |
for (i = 1; i <= NF; i++) { | |
if ($i == 1) ones[i]++ | |
else zeroes[i]++ | |
} | |
} | |
END { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
NewerOlder