Skip to content

Instantly share code, notes, and snippets.

Tim Stamp stampycode

Block or report user

Report or block stampycode

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stampycode
stampycode / hammer.sh
Created Oct 11, 2017
hammer a Vault server with encrypt + decrypt requests
View hammer.sh
#!/bin/bash
set -e
ITERATIONS=2000
BYTES=3000
pppp() {
PLAINTEXT=$(head -c${BYTES} /dev/random |base64)
View onename.id
Verifying that "stampycode.id" is my Blockstack ID. https://onename.com/stampycode
@stampycode
stampycode / print_re.php
Created Aug 23, 2017
Recursion-safe php variable dumper
View print_re.php
<?php
function print_re($data, $depth = 0, $max = 5) {
if(!headers_sent()) {
header('content-type: application/json');
}
$sp = str_repeat(" ", $depth);
if(is_numeric($data)) {
echo $data;
@stampycode
stampycode / regconnect.sh
Created Jun 23, 2017
Connect to Docker Registry and Fetch an Image without hard-coding credentials
View regconnect.sh
#!/bin/bash
if [[ ! -f bin/docker-credential-registrycreds ]] ; then
[[ ! -d bin ]] && mkdir bin
cat > bin/docker-credential-registrycreds <<FFF
cat <<JSON
{
"ServerURL": "https://registry.local/v1",
"Username": "${DOCKER_USER}",
"Secret": "${DOCKER_PASS}"
}
@stampycode
stampycode / nginx.conf
Last active May 18, 2017
NGinx multi-docker-container reverse proxy config
View nginx.conf
events {
worker_connections 1024;
}
http {
resolver 127.0.0.11;
server {
server_name ~^(?<ctrn>[^\.]+)-(qa|dev)\.;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@stampycode
stampycode / bash_ssh_sudo.sh
Last active May 17, 2017
how to BASH SSH and SUDO
View bash_ssh_sudo.sh
ssh ${SERVER} <<ENDSSH
cd ${REPO}
sudo -s -- <<SUDO
unset HISTFILE
[[ ! -d /root/.docker ]] && mkdir /root/.docker
[[ ! -e /root/.docker/config.json ]] && echo '{"credsStore": "registrycreds"}' > /root/.docker/config.json
[[ ! -d /root/bin ]] && mkdir /root/bin
echo > /root/bin/docker-credential-registrycreds <<<RRR
#!/bin/bash
@stampycode
stampycode / render.php
Last active Apr 4, 2017
Render binary data safely in html
View render.php
<?php
$data = str_split($data, 72);
$color = '#888';
$placeholder = '.';
$repl = function($m) use (&$color, &$placeholder) {
$x = str_repeat($placeholder, strlen($m[0]));
return "<span style=\"background-color:{$color};\">{$x}</span>';
};
foreach($data as &$d) {
$d = str_replace(['<','>'], ['&lt;','&gt;'], $d);
@stampycode
stampycode / How Strong Is Your Generated Key.php
Last active Feb 20, 2017
How Strong Is Your PRNG Generated Key
View How Strong Is Your Generated Key.php
| Example Key | Key Alphabet | Number of Possible Combinations
-------------------------------------------------------------------------------------------------------------------------
10**3 | 976 | Numerical | 1000
16**3 | 6d2 | Hexadecimal | 4096
10**4 | 9766 | Numerical | 10000 // eg. Bank Card Pin number
26**3 | bsa | Alphabetical | 17576
16**4 | 6d20 | Hexadecimal | 65536
10**5 | 97667 | Numerical | 100000
62**3 | bSA | a-zA-Z0-9 | 238328
64**3 | bSA | Base64 | 262144
@stampycode
stampycode / docker_registry_browser.php
Last active Oct 17, 2018
Interactive browser for a Docker Registry API (v2)
View docker_registry_browser.php
<?php
/**
* Browse a specified (v2) Docker Registry, examine layers, extract useful data >.>
**/
ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_WARNING);
$headers = [];
$type = isset($_GET['type']) ? $_GET['type'] : '_catalog';
$registry = (isset($_GET['registry'])) ? $_GET['registry'] : '';
@stampycode
stampycode / numberToWords.php
Last active May 1, 2017
Convert any positive integer to English
View numberToWords.php
<?php
$_1to19 = [
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
You can’t perform that action at this time.