Skip to content

Instantly share code, notes, and snippets.

View ljvmiranda921's full-sized avatar
☀️

Lj Miranda ljvmiranda921

☀️
View GitHub Profile
@ljvmiranda921
ljvmiranda921 / blogpost.md
Created August 24, 2018 08:33 — forked from MrNice/blogpost.md
Explain how to think about ansible and how to use it

Ansible

Understanding Ansible

Ansible is a powerful, simple, and easy to use tool for managing computers. It is most often used to update programs and configuration on dozens of servers at once, but the abstractions are the same whether you're managing one computer or a hundred. Ansible can even do "fun" things like change the desktop photo or backup personal files to the cloud. It can take a while to learn how to use Ansible because it has an extensive terminology, but once you understand the why and the how of Ansible, its power is readily apparent.

Ansible's power comes from its simplicity. Under the hood, Ansible is just a domain specific language (DSL) for a task runner for a secure shell (ssh). You write ansible yaml (.yml) files which describe the tasks which must run to turn plain old / virtualized / cloud computers into production ready server-beasts. These tasks, in turn, have easy to understand names like "copy", "file", "command", "ping", or "lineinfile". Each of these turns into shell comma

@ljvmiranda921
ljvmiranda921 / test_map_contract.py
Created September 12, 2018 07:50 — forked from abele/test_map_contract.py
Abstract Test or Contract Test with pytest
import pytest
def square(num):
return num * num
def recursive_map(f, _list):
"""Recusive map implementation."""
if not _list:
@ljvmiranda921
ljvmiranda921 / renderer.py
Last active July 27, 2021 22:52
QGIS method to export RAW image into rendered image
def export_as_rendered_image(layer, outfile):
"""Export a QGIS Layer as the rendered image
Usage
-----
Use this while working inside QGIS. As of now, I'm not sure
how to run this outside of QGIS. In addition, files are saved
in your home directory
..code-block:: python
@ljvmiranda921
ljvmiranda921 / index.js
Created December 18, 2018 15:46
Cloud Function template for creating status badge indicators
const { Storage } = require("@google-cloud/storage");
/**
* Auto-generated from cloud-build-badge. To deploy this cloud function, execute
* the following command:
* gcloud functions deploy christmAIs \
* --runtime nodejs6 \
* --trigger-resource cloud-builds \
* --trigger-event google.pubsub.topic.publish
*
int counter = 0;
int mode = 1;
bool mode_1_state = LOW;
bool mode_2_state = LOW;
unsigned long lastModeTime = 0;
int speed = 1000;
int led1_pin = 0;
int led2_pin = 1;
@ljvmiranda921
ljvmiranda921 / ents_to_spans.py
Created May 23, 2022 08:20
Spans key weird behaviour
import spacy
from spacy.tokens import DocBin, SpanGroup
from wasabi import msg
from copy import copy
def main():
text = "When Sebastian Thrun started working on self-driving cars at Google in 2007, few people outside of the company took him seriously."
nlp = spacy.load("en_core_web_sm")
doc = nlp(text)