Skip to content

Instantly share code, notes, and snippets.

@raphaelcastaneda
raphaelcastaneda / README.md
Last active July 3, 2024 16:56
Batch upload pidgin emote packs to slack

Pidgin emote pack uploader for Slack

Downloaded pidgin icon packs can be uploaded (one at a time) to Slack by posting the form. Note that this does not (yet) handle name conflicts with existing emotes. Failures to upload will be printed to the console.

Usage

install the requirements

pip install -r requirements.txt

Extract your icon pack into the working directory, under a new folder called "emote_files"

@raphaelcastaneda
raphaelcastaneda / rotary_encoder.py
Created January 9, 2017 08:24
A demo of using a rotary encoder with raspberry pi
import RPi.GPIO as GPIO
import time
# Pin definition
pwm_pin = 18 # adjust brightness for signal
led_pin = 23 # blink when switch pressed
clk_pin = 14 # rotary clock
but_pin = 24 # button input
dat_pin = 25 # rotary data input
@raphaelcastaneda
raphaelcastaneda / deploy.sh
Last active April 13, 2018 00:58
Setting up portainer on a docker swarm using portainer-endpoint
#! /bin/bash
#export PORTAINER_PASS=#TODO: add me
#export PORTAINER_ENC_PASS=$(docker run --rm httpd:2.4-alpine htpasswd -nbB admin ${PORTAINER_PASS} | cut -d ":" -f 2)
#echo $PORTAINER_PASS | docker secret create portainer_password.v1 --label portainer -
docker stack deploy --compose-file docker-compose.yml portainer

Resizing the primary partition on an Ubuntu machine

So you've added space to a VM but Ubuntu still shows the old size? The partition was created with a certain size, so that new space will just be unallocated until you add it to a partition. You could just add a new partition, but chances are you want the root partition to be bigger, yes?

The steps

Before proceeding, realize that there is a very real possibility that you will lose data if you mess this up. Still here? Cool.

@raphaelcastaneda
raphaelcastaneda / lastpass_cli_helper.sh
Created January 31, 2019 01:49
Bash function to search lastpass cli and put passwords on your clipboard
function getpw() {
if [ $# -lt 1 ]; then
echo "Usage: getpw <LPASS_ENTRY>"
return 1
fi
options=$(lpass ls | egrep -i "$*")
count=$(echo "$options" | wc -l | sed 's/ //g')
if [ $count -gt 1 ]; then
echo "$options"
echo "Too many LastPass entries returned. Please pick from one of the above $count items."
@raphaelcastaneda
raphaelcastaneda / get_plugin_instance.groovy
Created April 15, 2020 18:54
Getting a jenkins plugin by name
def pluginByName = Jenkins.instance.getPluginManager().getPlugin("artifactory");
println "\nFOUND Plugin ${pluginByName.getShortName()} (${pluginByName.getVersion()})"
//println pluginByName.getProperties().toString()
def pluginWrapper = pluginByName.plugin
//println pluginInstance.getProperties().toString()
def myPlugin = this.class.classLoader.loadClass(pluginByName.pluginClass.toString())
println myPlugin.getProperties().toString()
@raphaelcastaneda
raphaelcastaneda / configure_jenkins_artifactory.groovy
Created April 15, 2020 18:58
Configuring jenkins artifactory plugin from a groovy script
import jenkins.model.*
import org.jfrog.hudson.ArtifactoryBuilder
import org.kohsuke.stapler.Stapler
import net.sf.json.JSONObject
def instance = Jenkins.getInstance()
def descriptor = instance.getDescriptor(ArtifactoryBuilder.class);
def artifactoryCreds = [
username: "admin",
@raphaelcastaneda
raphaelcastaneda / pythonlogger.json
Created September 2, 2020 01:06
lnav python logger interpretter
{
"pythonlogger": {
"title": "Python logger format",
"description": "Log format used by python logger class",
"url": "",
"regex": {
"main": {
"pattern": "^\\[(?<timestamp>\\d{4}\\-\\d{2}\\-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d{3})] (?<level>\\w+) (?<module>(\\w(\\.)?)+) \\- (?<body>.*)$"
}
},