Recent Pads - Page 3

Total pad count: 586
created 164 days, 6 hours ago
uri-hasher

def uri_hasher(uri):
    return hashlib.sha256(uri).digest().encode('base64').rstrip('=\n').replace('/', '_').replace('+', '-')

>>> uri_hasher('https://www.remarkbox.com')
'20955U4mj67Fv-uGOsxnBZUoyKXkpIU9XnXuBHSC2A4'
... view all 5 lines

created 172 days, 1 hour ago
ca252ca3-963c-4cb1-8540-e57c59345a5f

gone
... view all 1 lines

created 172 days, 3 hours ago
botoform-dump-all-route53-record-sets-as-yaml

from ruamel import yaml
from ruamel.yaml.comments import CommentedMap

from collections import OrderedDict

KEYS = [
    'Name',
... view all 87 lines

created 179 days, 7 hours ago
python-make-env-var-name

#!/usr/bin/env python
import re

RE_UNSAFE = re.compile(r'[^A-Z0-9_]')
RE_DEDUPE = re.compile(r'_+')

def make_env_var_name(*args):
... view all 32 lines

created 184 days, 8 hours ago
42389318-1d87-4fbb-a2a7-8c0dab518e8b

Human art imatates nature
AI art imatates humans who imatate nature

Oil on Canvas that looks like marble
 or granent

Wood cut to look like termite damage
... view all 16 lines

created 188 days, 10 hours ago
setup-a-mac

Long story short, I have setup 3 macbook pros in the last 4 years for work.
This document lists some of the very first things I do to make it "mine".

1. Make the right "Hot corner" start my screensaver and automatically lock my screen.

2. Install brew.

... view all 26 lines

created 190 days, 13 hours ago
pbzip2-versus-gzip-4-gb-file

-rw-r--r--   1 root     root        4.4G Jun  4 14:10 letsencrypt1
-rw-r--r--   1 root     root        4.4G Jun  4 14:10 letsencrypt2


[root@host /opt]# time pbzip2 letsencrypt1
real	1m47.420s
user	40m21.814s
... view all 19 lines

created 195 days, 23 hours ago
82225825-9d0a-4a95-85c2-649018785509

recent pads


\[s
[

s
... view all 9 lines

created 200 days, 7 hours ago
0ba4fc59-1a86-41fb-bd4b-f8a76e07bfc8

gone
... view all 1 lines

created 201 days, 9 hours ago
sqlite3-remove-and-rename-some-columns

BEGIN TRANSACTION;

ALTER TABLE User RENAME TO temp_User;

CREATE TABLE "User" (
        id CHAR(32),
        name VARCHAR(64) NOT NULL,
... view all 106 lines

created 206 days, 8 hours ago
simple-python-selenium-client

#cat source-me.sh
#export JUNIT_HOME="$HOME/jars"
#export PATH="$PATH:$JUNIT_HOME"
#export CLASSPATH="$CLASSPATH:$JUNIT_HOME/junit-4.12.jar:$JUNIT_HOME/hamcrest-all-1.3.jar:$JUNIT_HOME/selenium-java-2.53.1.jar:$JUNIT_HOME/selenium-server-standalone-2.53.1.jar"

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
... view all 32 lines

created 208 days, 14 hours ago
ddb8178d-5273-451e-9541-7767e1354e81

[root@ip-10-13-37-7 specs]# kubectl get nodes
NAME              STATUS    AGE       VERSION
ip-10-13-37-133   Ready     14d       v1.6.2
ip-10-13-37-135   Ready     14d       v1.6.2
ip-10-13-37-136   Ready     14d       v1.6.2
ip-10-13-37-142   Ready     14d       v1.6.2
ip-10-13-37-148   Ready     14d       v1.6.2
... view all 113 lines

created 214 days, 3 hours ago
docker-swarm-on-aws-running-selenium-grid

# firewall (secrity groups) required the following for swarm docker overlay networking:
# Port 7946 TCP/UDP for container network discovery.
# Port 4789 UDP for the container overlay network.
# As a quick hack I allowed all TCP and UDP between minions (including master)

### yum install docker on all hosts ###
salt -G 'role:k8s-master' cmd.run 'yum install -y docker'
... view all 85 lines

created 214 days, 12 hours ago
81eb2c17-540f-4f2c-b05d-a79f4cddb378

07:57:31.915 INFO - Executing: [new session: Capabilities [{browserName=chrome, javascriptEnabled=true, version=, platform=ANY}]])
07:57:31.917 INFO - Creating a new session for Capabilities [{browserName=chrome, javascriptEnabled=true, version=, platform=ANY}]
Starting ChromeDriver 2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3) on port 13598
Only local connections are allowed.
11/05/2017 07:57:32 idle keyboard:   turning X autorepeat back on.
07:57:32.426 INFO - Done: [new session: Capabilities [{browserName=chrome, javascriptEnabled=true, version=, platform=ANY}]]
07:57:32.989 INFO - Executing: [get: https://linkpeek.com])
... view all 28 lines

created 216 days, 8 hours ago
c7fc2c77-dfb1-4af1-8468-c5a3f7d542fb

# on a single server, open firewall to 4444 and 5900 and then run this on:
docker run -d -p 4444:4444 --name selenium-hub selenium/hub:2.53.1
docker run -d -P -p 5900:5900 --privileged -v /dev/shm:/dev/shm --link selenium-hub:hub selenium/node-chrome-debug:2.53.1

# verify.
curl 127.0.0.1:4444/grid/console

... view all 13 lines

created 219 days, 3 hours ago
parse-url-overrides-refactor

def parse_url_overrides(kw):
    """Parse special arguments passed when generating urls.

    The supplied dictionary is mutated when we pop arguments.
    Returns a 6-tuple of the format:

      ``(app_url, scheme, host, port, qs, anchor)``.
... view all 27 lines

created 219 days, 8 hours ago
pyramid-route-url-safe-kwargs

>>> test_data = {'_anchor' : None, 'slug' : 'tester-fester'}
>>>
>>> def remove_keys_with_value_of_none(kwargs):
...     copy_kwargs = kwargs.copy()
...     for key, value in kwargs.items():
...         if value is None:
...             del copy_kwargs[key]
... view all 11 lines

created 224 days, 4 hours ago
china-kubernetes

[root@ip-10-13-37-7 ~]# kubeadm init
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.6.0
[init] Using Authorization mode: RBAC
[preflight] Running pre-flight checks
[preflight] WARNING: hostname "ip-10-13-37-7" could not be reached
[preflight] WARNING: hostname "ip-10-13-37-7" lookup ip-10-13-37-7 on 10.13.37.2:53: no such host
... view all 31 lines

created 224 days, 7 hours ago
a0511f22-bd0a-4a2d-84d2-d1335785455f

curl -sSL http://k8s.oss-cn-shanghai.aliyuncs.com/kube/rpm/kubectl-1.5.1.x86_64.rpm -o /tmp/kubectl-1.5.1.x86_64.rpm 
curl -sSL http://k8s.oss-cn-shanghai.aliyuncs.com/kube/rpm/kubelet-1.5.1.x86_64.rpm -o /tmp/kubelet-1.5.1.x86_64.rpm 
curl -sSL http://k8s.oss-cn-shanghai.aliyuncs.com/kube/rpm/kubernetes-cni-0.3.0.1-1.07a8a2.x86_64.rpm -o /tmp/kubernetes-cni-0.3.0.1-1.07a8a2.x86_64.rpm 
curl -sSL http://k8s.oss-cn-shanghai.aliyuncs.com/kube/rpm/kubeadm-1.6.0-0.alpha.0.2074.a092d8e0f95f52.x86_64.rpm -o /tmp/kubeadm-1.6.0-0.alpha.0.2074.a092d8e0f95f52.x86_64.rpm 

rpm -ivh /tmp/kubectl-1.5.1.x86_64.rpm /tmp/kubelet-1.5.1.x86_64.rpm kubernetes-cni-0.3.0.1-1.07a8a2.x86_64.rpm  /tmp/kubeadm-1.6.0-0.alpha.0.2074.a092d8e0f95f52.x86_64.rpm 

... view all 28 lines

created 227 days, 5 hours ago
aws-sns-slurp-py

from argparse import ArgumentParser

import boto3

from botocore.exceptions import ClientError

from time import sleep
... view all 102 lines

pages 1 2 3 4 5 .. 30