Skip to content

Instantly share code, notes, and snippets.

View ljvmiranda921's full-sized avatar
☀️

Lj Miranda ljvmiranda921

☀️
View GitHub Profile
@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)
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 / 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
*
@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 / 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 / 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

Keybase proof

I hereby claim:

  • I am ljvmiranda921 on github.
  • I am ljvmiranda (https://keybase.io/ljvmiranda) on keybase.
  • I have a public key whose fingerprint is 376B DF4D EA41 70D5 B37B AAA9 6C14 1C78 7DF0 930A

To claim this, I am signing this object:

@ljvmiranda921
ljvmiranda921 / Makefile
Last active September 10, 2018 10:58
Contains a minimal workflow for compiling LaTeX documents
# A Simple Makefile for LaTeX
# Author: Lester James V. Miranda
# E-mail: ljvmiranda@gmail.com
# Default variables which can be edited via the terminal
BUILDDIR = _build
COMPILER = pdflatex
PROJECT = main
BIBLIOGRAPHY = bibliography
@ljvmiranda921
ljvmiranda921 / tlsetup.sh
Created February 4, 2018 08:04
Set-up script to install a minimal TexLive 2015 Distribution
#!/usr/bin/env bash
#
# Minimal Travis Set-up Script
#
# This script sets-up a minimal TexLive 2015 distribution with the
# additional packages being installed when needed. This is intended
# for Travis continuous integration and is expected to work with the
# Ubuntu Trusty (14.04) Distribution
#
# Copyright (C) 2018 Lester James V. Miranda <ljvmiranda@gmail.com>
@ljvmiranda921
ljvmiranda921 / .travis.yml
Created February 4, 2018 07:15
YAML file for Travis build for LaTeX file continuous integration and automatic deployment
sudo: required
dist: trusty
before_install:
- openssl aes-256-cbc -K $encrypted_65b80f527c7e_key -iv $encrypted_65b80f527c7e_iv -in .dropbox_uploader.enc -out ~/.dropbox_uploader -d
- ./tlsetup.sh
script:
- make latex COMPILER=xelatex
- ./dropbox_uploader.sh upload _build/main.pdf ${TRAVIS_BRANCH}/main-latest.pdf
- ./dropbox_uploader.sh upload _build/main.pdf ${TRAVIS_BRANCH}/main-${TRAVIS_JOB_NUMBER}.pdf