Skip to content

Instantly share code, notes, and snippets.

View AnneTheAgile's full-sized avatar

AnneTheAgile

  • Fan of http://www.CodeTriage.com
View GitHub Profile
@confiks
confiks / ask_key.py
Last active May 2, 2018 20:08
A simple ansible action plugin to ask the user to input a key, in the middle of a role
# Not extensively tested
# Put this script in the action_plugins directory of your playbook directory
# If you have issues, please report it in the comments (or fork and fix)
# Usage:
# - name: "Ask the user if we should continue."
# action: ask_key prompt="Continue? Yes / No / Random (y/n/r)?" accepted_keys="['y', 'n', 'r']"
# register: answer
#
# The pressed key is now in answer.key
-- Code from a meetup presentation: http://www.meetup.com/N-Languages-in-N-Months-NYC/events/202521322/
-- Implements half adder and full adder circuits
-- Installation: `brew install ghc cabal-install`
-- Check compilation: `ghc Main.hs`
-- Load into repl:
-- $ cabal repl`
-- Prelude> :l Main.hs
module Main where
@audionerd
audionerd / Forwarding ports from a docker container with Vagrant 1.6.md
Last active June 25, 2019 20:45
Forwarding ports from a docker container with Vagrant 1.6

Forwarding ports from a docker container with Vagrant 1.6

Vagrant 1.6 has a really nice feature which allows you to run a docker environment from any machine that can run Vagrant (even a Mac)

Behind the scenes, Vagrant creates a host VM which runs the docker containers.

The "gotcha" is: Vagrant won't automatically forward ports all the way back from the container->vagrant host VM->your mac. You have to do that step manually, by configuring your own host VM for Vagrant to use for hosting docker containers with. That host VM is told what ports to open.

Here's how I set up a local Wordpress development testing container.

@tstone2077
tstone2077 / git-cloneall
Last active October 28, 2022 08:53
Clones as usual but creates local tracking branches for all remote branches.
#!/bin/bash
# Clones as usual but creates local tracking branches for all remote branches.
# To use, copy this file into the same directory your git binaries are (git, git-flow, git-subtree, etc)
clone_output=$((git clone "$@" ) 2>&1)
retval=$?
echo $clone_output
if [[ $retval != 0 ]] ; then
exit 1
@lamw
lamw / gist:9928202
Created April 2, 2014 05:00
Parsing JSON in PowerShell using ConvertFrom-Json
$json = @"
{"A": {"property1": "value1", "property2": "value2"}, "B": {"property1": "value3", "property2": "value4"}}
"@
$parsed = $json | ConvertFrom-Json
foreach ($line in $parsed | Get-Member) {
echo $parsed.$($line.Name).property1
echo $parsed.$($line.Name).property2
}
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@hmason
hmason / fetch_locu_data.py
Last active July 29, 2023 19:21
A quick script to fetch data from the locu api by query and zip code.
import sys
import os
import json
import csv
import time
import pickle
import requests
API_KEY = [YOUR API KEY GOES HERE]
@dutc
dutc / notes.md
Last active July 1, 2022 20:57
CPython workshop

themes

  1. CPython for greater understanding of the Python programming language (but "reference implementations always overspecify") Reading source to solve problems
  2. getting involved, contributing to the project

introduction

This workshop will cover the basics of the CPython runtime and interpreter. There is an enormous amount of material to cover, and I'll try to to rush through as much as I can.

@cdhunt
cdhunt / Get-CredentialFromWindowsCredentialManager.ps1
Last active June 1, 2023 23:48 — forked from toburger/Get-CredentialFromWindowsCredentialManager.ps1
Gets a PowerShell Credential [PSCredential] from the Windows Credential Manager. This only works for Generic Credentials.
<#
.SYNOPSIS
Gets a PowerShell Credential (PSCredential) from the Windows Credential Manager
.DESCRIPTION
This module will return a [PSCredential] object from a credential stored in Windows Credential Manager. The
Get-StoredCredential function can only access Generic Credentials.
Alias: GSC

Dotfiles Lite

Taken from mathiasbynens/dotfiles. Save time and pain from customising your clean-installed Mac, install web development tools and native applications. It's straight-forward and simple, here's how you run it:

Download osx.sh and tools.sh to your desktop, open osx.sh on your favorite text editor and change these lines:

# Set computer name (as done via System Preferences → Sharing)
sudo scutil --set ComputerName "Pongstr"