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
<?php | |
function modify_url($mod, $url = FALSE){ | |
// If $url wasn't passed in, use the current url | |
if($url == FALSE){ | |
$scheme = $_SERVER['SERVER_PORT'] == 80 ? 'http' : 'https'; | |
$url = $scheme.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; | |
} | |
// Parse the url into pieces | |
$url_array = parse_url($url); |
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
<?php | |
$url = modify_url(array('p' => 4, 'show' => 'column'), 'http://www.example.com/page.php?p=5&show=list&style=2'); | |
?> |
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/sh | |
for FILE in `git diff --name-only`; do | |
grep 'MYTODO' $FILE 2>&1 >/dev/null | |
if [ $? -eq 0 ]; then | |
echo $FILE ' contains MYTODO' | |
exit 1 | |
fi | |
done | |
exit |
Most modern languages include a library for dealing with json, including converting a native object to a json string.
In the language of your choice, write a function to convert a native object to a json string.
A python example is provided below.
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
{"timestamp":1529778230155,"data":{"ace":[{"timestamp":1529778230155,"stars":36,"forks":6,"issues":0}],"acrylamid":[{"timestamp":1529778230155,"stars":295,"forks":41,"issues":44}],"adm-dev-kit":[{"timestamp":1529778230155,"stars":30,"forks":5,"issues":11}],"amsf":[{"timestamp":1529778230155,"stars":156,"forks":80,"issues":6}],"anodize":[{"timestamp":1529778230155,"stars":2,"forks":0,"issues":0}],"antwar":[{"timestamp":1529778230155,"stars":391,"forks":27,"issues":7}],"asimov-static":[{"timestamp":1529778230155,"stars":4,"forks":4,"issues":0}],"assemble":[{"timestamp":1529778230155,"stars":3563,"forks":247,"issues":25}],"awestruct":[{"timestamp":1529778230155,"stars":257,"forks":73,"issues":57}],"bake":[{"timestamp":1529778230155,"stars":18,"forks":3,"issues":0}],"baker":[{"timestamp":1529778230155,"stars":38,"forks":7,"issues":1}],"bang":[{"timestamp":1529778230155,"stars":8,"forks":1,"issues":0}],"bashblog":[{"timestamp":1529778230155,"stars":671,"forks":112,"issues":20}],"blackhole":[{"timestamp":1529778230 |
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
apt update | |
# Install driver for wireless card | |
apt install bcmwl-kernel-source | |
# Make function keys work correctly | |
echo 2 > /sys/module/hid_apple/parameters/fnmode | |
# Map caps lock to escape | |
setxkbmap -option caps:escape |
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
// Find duplicate ids | |
var allElements = document.getElementsByTagName("*"), allIds = {}, dupIDs = []; | |
for (var i = 0, n = allElements.length; i < n; ++i) { | |
var el = allElements[i]; | |
if (el.id) { | |
if (allIds[el.id] !== undefined) { | |
dupIDs.push(el.id); | |
} | |
allIds[el.id] = el.name || el.id; | |
} |
Using these settings, I was able to get logged in to rundeck using oauth2 with google as the provider. More specifically, it's using gsuite and only works for users belonging to a specified group (ops@example.com).
You'll need to follow the setup steps here to get your gsuite setup ready for use: https://pusher.github.io/oauth2_proxy/auth-configuration#google-auth-provider
- This setup is insecure as there is no SSL setup. I've only used it locally for testing.
- oauth2_proxy does not support returning the groups a user is a memer of, so they cannot be passed to rundeck. This is why the group name is currently hardcoded. Not a good solution for most situations.
OlderNewer