Skip to content

Instantly share code, notes, and snippets.

View guapodero's full-sized avatar

Daniel James Baumann guapodero

View GitHub Profile
@guapodero
guapodero / tennant_gcp.py
Created November 10, 2023 23:08
A self-contained CLI for google cloud compute instances.
#!/usr/local/src/tennant_gcp/venv/bin/python
"""
argparse
requests
google-cloud-compute
google-cloud-logging
google-cloud-secret-manager
"""
#;venv=$(head -1 $0 | grep -Po '#!\K.+/venv');
#;sudo python -m venv ${venv};
@guapodero
guapodero / scrollfollow.coffee
Last active December 30, 2015 04:09
Derived from http://isotope11.com/blog/make-a-snappable-cart-directive-with-angularjs Usage <div scrollfollow="45" id="scrollfollow1"> I stick to the viewport on scroll, 45 pixels from the top. I'll stay aligned to a grid like that of Bootstrap 3, leaving the normal page flow without creating a wake. You can also disable me with media queries an…
angular.module("ui-utils-too", []).
directive("scrollfollow", ["$window", ($window) ->
restrict: "A"
link: (scope, el, attrs) ->
window = angular.element($window)
parent = angular.element(el.parent())
currentOffsetTop = el[0].getBoundingClientRect().top
headerOffsetTop = scope.$eval(attrs.scrollfollow) || 5
# assumes width/padding in px
@guapodero
guapodero / jack_parser.scala
Created April 20, 2012 22:05
A recursive descent parser for Jack
package compiler
import scala.collection.mutable.LinkedList
/** A `Parser` which understands the Jack grammar.
*/
object JackParser extends Parser {
def parse(tokenizer: BufferedIterator[Token], tree: TreeNode[TreeValue]) {
tokenizer.head match {