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 python | |
# | |
# This is a Python implementation of the QuickPerm algorithm described by Phillip Paul Fuchs at http://www.quickperm.org | |
# that generates all permutations of a list without using recursion. | |
# | |
a = ['a', 'b', 'c', 'd'] | |
N = len(a) |
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
from bs4 import BeautifulSoup | |
from urllib2 import Request, urlopen | |
import decimal | |
def findPrice(url, selector): | |
userAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36" | |
req = Request(url, None, {'User-Agent': userAgent}) | |
html = urlopen(req).read() | |
soup = BeautifulSoup(html, "lxml") | |
return decimal.Decimal(soup.select(selector)[0].contents[0].strip().strip("$")) |
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
<html> | |
<head> | |
<title>Example Web Page</title> | |
<style> | |
.container { | |
display: table; | |
} | |
.row { | |
display: table-row; | |
} |
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
using System; | |
using System.Linq; | |
using Windows.Devices.Bluetooth.Advertisement; | |
using Windows.Storage.Streams; | |
namespace BeaconExample | |
{ | |
class Program | |
{ | |
private class BeaconData |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<WebPublishMethod>FileSystem</WebPublishMethod> | |
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration> | |
<LastUsedPlatform>Any CPU</LastUsedPlatform> | |
<SiteUrlToLaunchAfterPublish /> | |
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> | |
<ExcludeApp_Data>False</ExcludeApp_Data> | |
<publishUrl>C:\Publish\SimpleExample</publishUrl> |
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
var AWS = require("aws-sdk"); | |
exports.handler = (event, context, callback) => { | |
var sns = new AWS.SNS(); | |
sns.publish({ | |
Message: 'YOUR MESSAGE HERE', | |
Subject: 'YOUR SUBJECT HERE', | |
TopicArn: 'YOUR SNS TOPIC ARN HERE' | |
}, function() { | |
callback(null, { |
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 | |
ts=`date +%Y%m%d_%H%M%S` | |
rsync -rtm --compare-dest=/mnt/usb1/backups/snapshot --modify-window=2 /share /mnt/usb1/backups/$ts | |
find /mnt/usb1/backups/$ts -type d -empty -delete | |
rsync -rt --delete --modify-window=2 /share /mnt/usb1/backups/snapshot |
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
version: '3' | |
services: | |
elasticsearch: | |
container_name: elasticsearch | |
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.0 | |
volumes: | |
- esdata:/usr/share/elasticsearch/data | |
ports: |
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 | |
nodeport=$(kubectl get services -o jsonpath="{..nodePort}") && kubectl get node -o jsonpath="{..addresses[0].address}" | xargs -n1 printf -- "http://%s:$nodeport\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
wget -O /tmp/metrics-server-master.zip https://github.com/kubernetes-sigs/metrics-server/archive/master.zip | |
unzip -u /tmp/metrics-server-master.zip -d /tmp | |
rm /tmp/metrics-server-master.zip | |
kubectl apply -f /tmp/metrics-server-master/deploy/1.8+/ | |
rm -rf /tmp/metrics-server-master | |
kubectl patch deploy metrics-server -n kube-system --type json --patch '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"},{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname"}]' |
OlderNewer