Skip to content

Instantly share code, notes, and snippets.

View insanity54's full-sized avatar

Chris Grimmett insanity54

View GitHub Profile
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@alisterscott
alisterscott / watir-webdriver-downloads.rb
Created June 15, 2012 11:46
How to check for downloads to complete and get the file name
require 'watir-webdriver'
file_name = nil
download_directory = "#{Dir.pwd}/downloads"
download_directory.gsub!("/", "\\") if Selenium::WebDriver::Platform.windows?
downloads_before = Dir.entries download_directory
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.folderList'] = 2 # custom location
profile['browser.download.dir'] = download_directory
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@insanity54
insanity54 / bash dirname path
Last active October 22, 2015 23:41
Get the absolute path of the directory of the bash script
#!/bin/bash
# Gets the absolute path of the directory of this bash script. works in Linux & OSX
# greets to https://stackoverflow.com/questions/394230/detect-the-os-from-a-bash-script
# greets to https://stackoverflow.com/questions/3572030/bash-script-absolute-path-with-osx
function detectplatform {
platform='unknown'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
@uberscientist
uberscientist / gist:8a89ff8b7810275f322f
Created July 3, 2015 19:56
quick gist of dreaming video
# could be a lot more readable if I just broke the deepdream out into a module...
import os
#Copied from deepdream iPython notebook
# imports and basic notebook setup
from cStringIO import StringIO
import numpy as np
import scipy.ndimage as nd
import PIL.Image
from google.protobuf import text_format
@tyler-smith
tyler-smith / ports.md
Last active November 4, 2016 17:58
OpenBazaar Server Ports

Your firewall must allow the following ports. TCP ports must allow incoming connections and the UDP port must allow both incoming and outgoing connections.

Mainnet:

Purpose Protocol Port Flag
DHT UDP 18467 -p
REST TCP 18469 -r
WS TCP 18466 -w
Heartbeat TCP 18470 -b
@princebot
princebot / install_wormhole.bat
Created July 29, 2017 17:44
Install Python magic-wormhole on Windows.
::
:: This script installs wormhole (https://github.com/warner/magic-wormhole) and
:: its prerequisites. Run this as an administrator.
::
:: Install chocolatey.
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
:: Install Python 3.
choco install -y python
@zulhfreelancer
zulhfreelancer / install-docker.md
Last active April 25, 2024 02:35
Install Docker oneliner script

Just install Docker

$ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

Install Docker and Rancher Server

$ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh && sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server

@danisla
danisla / terraform-install.sh
Last active August 27, 2023 17:05
Terraform latest version install script
#!/bin/bash
function terraform-install() {
[[ -f ${HOME}/bin/terraform ]] && echo "`${HOME}/bin/terraform version` already installed at ${HOME}/bin/terraform" && return 0
LATEST_URL=$(curl -sL https://releases.hashicorp.com/terraform/index.json | jq -r '.versions[].builds[].url' | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | egrep -v 'rc|beta' | egrep 'linux.*amd64' |tail -1)
curl ${LATEST_URL} > /tmp/terraform.zip
mkdir -p ${HOME}/bin
(cd ${HOME}/bin && unzip /tmp/terraform.zip)
if [[ -z $(grep 'export PATH=${HOME}/bin:${PATH}' ~/.bashrc) ]]; then
echo 'export PATH=${HOME}/bin:${PATH}' >> ~/.bashrc
@JoelQ
JoelQ / list-pattern-matching-elm.md
Last active December 5, 2021 16:39
What does `x :: xs` pattern matching mean in Elm?

What does x :: xs pattern matching mean in Elm?

:: is the list prepend operator in Elm.

3 :: 2 :: 1 :: []

is equivalent to