Skip to content

Instantly share code, notes, and snippets.

View flotwig's full-sized avatar

Zach Bloomquist flotwig

View GitHub Profile
@flotwig
flotwig / performance.csv
Last active May 1, 2019 19:22
Cypress performance tests
branch name time url disableHttp2 upstreamProxy httpsUpstreamProxy cyProxy cyIntercept
const fs = require('fs')
const debug = require('debug')('net-profiler')
function getCaller (level = 5) {
try {
return new Error().stack.split('\n')[level].slice(7)
} catch (e) {
return 'unknown'
}
}
@flotwig
flotwig / 1. server.py.md
Last active February 18, 2019 03:33 — forked from IbroCalculus/server.py
Server code for python remote access of another machine on which the server part of this code has been installed

import socket

s = socket.socket()

host = socket.gethostname() port = 9009 s.bind((host,port)) print('This host/server ID is: ', host) print('\n',host,'has been binded to',port) print('\nServer is listening for incoming connections')

@flotwig
flotwig / test
Last active January 14, 2019 00:19
Started out private
111now its public
#!/usr/bin/env python3
#!c:/Python35/python3.exe -u
import asyncio
import sys
import cv2
import numpy as np
import cozmo
import time
import os
from glob import glob
import cv2
import numpy as np
import time
def filter_image(img, hsv_lower, hsv_upper):
img_filt = cv2.medianBlur(img, 11)
hsv = cv2.cvtColor(img_filt, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, hsv_lower, hsv_upper)
return mask
@flotwig
flotwig / reddit-function.php
Created October 6, 2012 18:22
A simple function to retrieve results from reddit's API
<?php
// example usage:
// redditApi('user/flotwig'); will return an array with information about me
// redditApi('r/breakingbad'); will return an array of info about r/breakingbad
function redditApi($call,$domain='www.reddit.com') {
$url = 'http://' . $domain . '/' . $call . '.json';
if (function_exists('curl_init')) { // not all PHP installs have cURL
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($ch,CURLOPT_USERAGENT,'/u/flotwig'); // for stats
@flotwig
flotwig / digresults.txt
Created September 19, 2012 20:29
dig -t SRV @ns1.niftyhost.us _minecraft._tcp.seang96.n1fty.com
; <<>> DiG 9.7.3 <<>> -t SRV @ns1.niftyhost.us _minecraft._tcp.seang96.n1fty.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28120
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;_minecraft._tcp.seang96.n1fty.com. IN SRV
@flotwig
flotwig / gist:3591447
Created September 1, 2012 23:44
bool isup(str $server, int $port) // check to see if a server is reachable
function isup($server,$port=80) {
if ($port==80||$port==2222||$port==2083) {
$up = @file_get_contents('http://' . $server . ':' . $port);
if (!$up) {
$up = @file_get_contents('http://' . $server . ':' . $port);
}
} else {
$up = @fsockopen($server, $port, $errno, $errstr, 2);
if (!$up) {
$up = @fsockopen($server, $port, $errno, $errstr, 2);
<?php
ini_set('xdebug.max_nesting_level', 10000000000000000000000000000000);
$set = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0','@','!','#','$','%','^','&','*','(',')','-',' ','+','-');
$set = array_merge($set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set);
$results = array();
gen_nos($set,$results);
function gen_nos(&$set, &$results) {
for($i=0; $i<count($set); $i++) {
$results[] = $set[$i];
$tempset = $set;