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 FindProxyForURL(url, host) { | |
if(dnsDomainIs(host, "postman-echo.com")) { | |
return "PROXY squid.corp.redhat.com:3128"; | |
} | |
return "DIRECT"; | |
} |
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
# Ran on my Mac on WiFi | |
nmap -oG - -A -p22 "$(ipconfig getifaddr en0 | cut -d . -f 1-3).0/24" | grep Raspbian | cut -d ' ' -f 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
#!/usr/bin/env bash | |
set \ | |
-o nounset \ | |
-o pipefail \ | |
-o errexit | |
checkdep() { | |
cmd="$1" | |
if ! which "$1" > /dev/null; | |
then |
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 os | |
import subprocess | |
from ansible.errors import AnsibleParserError | |
from ansible.module_utils._text import to_native | |
from ansible.plugins.vars import BaseVarsPlugin | |
from ansible.inventory.host import Host | |
from ansible.inventory.group import Group | |
from ansible.utils.vars import combine_vars | |
from ansible.parsing.utils.yaml import from_yaml |
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
// PDF download hack taken from https://github.com/GoogleChrome/puppeteer/issues/610#issuecomment-340160025 | |
const puppeteer = require("puppeteer"); | |
const fs = require("fs"); | |
(async () => { | |
const browser = await puppeteer.launch({ headless: true }); | |
const page = await browser.newPage(); | |
await page.goto( | |
"https://synopsys.atlassian.net/wiki/spaces/INTDOCS/pages/622678/Running+Black+Duck+Detect+with+Bamboo" | |
); |
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
package main | |
//Given a list of numbers and a number k, return whether any two numbers from the list add up to k. | |
//For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. | |
import ( | |
"fmt" | |
"math/rand" | |
) |
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
package main | |
//Given a tree, determine how many of its subtrees are inival trees. | |
//A unival tree is a tree where all nodes have the same value. | |
//An empty tree is a single unival tree. | |
//A tree with one node is a single unival tree. | |
//Assumptions | |
// - A tree whose value equals one of its children and the other child is nil is not a unival tree. | |
// - nil children do not contribute to the count of unival trees. |
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
package main | |
import "fmt" | |
//You're given a target number of steps and the avialable options for | |
//how many steps you can take at time. Find the number of options to get | |
//to the top. | |
//Assumptions | |
// - Can't make 0 steps since applying a step size of 0 at any point will yield infinite options. |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
func fill(size int) []int { | |
slice := make([]int, 0, size) | |
for i := 0; i < size; i++ { |
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
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
type Fetcher interface { | |
// Fetch returns the body of URL and | |
// a slice of URLs found on that page. |
NewerOlder