Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖

Jim Rybarski jimrybarski

🤖
View GitHub Profile
View monitor-switch.sh
#!/bin/bash
# modified from https://faq.i3wm.org/question/5312/how-to-toggle-onoff-external-and-internal-monitors.1.html
# this script will toggle which monitors are on. after booting, all monitors will be clones of the main laptop monitor.
# after each execution, we cycle through the following modes:
# - external monitor only (work mode)
# - external and laptop on but not clones (presentation mode)
# - laptop monitor only
@jimrybarski
jimrybarski / pycharm.sh
Last active Apr 30, 2020
PyCharm installation script
View pycharm.sh
# Copyright (c) 2015 Jim Rybarski
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
@jimrybarski
jimrybarski / accomplish.sh
Last active Aug 29, 2015
Accomplishments log
View accomplish.sh
# I use this to keep track of things I've done during the day. It's mostly a motivational tool.
# I find that the fear of a sparse log at the end of the day drives me to look for things I can
# accomplish in a short period of time.
# Creating an alias for the script is recommended.
# Usage:
# $ ./accomplish.sh refactored the robot-targeting code
# $ ./accomplish.sh
# Fri Aug 27 | refactored the robot-targeting code
View cheeseburger.py
import os, skimage.io, skimage.exposure, numpy
for dir_name, dir_names, filenames in os.walk("/home/jim/Desktop/experiments/141111/kymograph"):
for image_name in filenames:
filename = "/".join([dir_name, image_name])
original_image = skimage.io.imread(filename)
enhanced_image = skimage.exposure.rescale_intensity(original_image, in_range=tuple(numpy.percentile(original_image, (2, 98))))
skimage.io.imsave(filename.split(".")[0] + "_enhanced.png", enhanced_image)
@jimrybarski
jimrybarski / bootstrap.sh
Last active Feb 27, 2016
Bootstrap my installer
View bootstrap.sh
#!/bin/bash
# After installing Ubuntu on a machine I run this script. It removes packages I don't use,
# improves the security situation slightly, and installs the minimal set of packages I need
# to do all my work.
# Usage:
# sudo chmod +x bootstrap.sh
# sudo ./bootstrap.sh
View daemon3.py
"""Generic linux daemon base class for python 3.x."""
import sys, os, time, atexit, signal
class daemon:
"""A generic daemon class.
Usage: subclass the daemon class and override the run() method."""
def __init__(self, pidfile): self.pidfile = pidfile
@jimrybarski
jimrybarski / inventory
Created Jan 28, 2014
Ansible inventory with ipv6 address that does not work correctly
View inventory
[blank]
2001:4800:7816:0517:8b5b:f2a3:ff04:4f29
@jimrybarski
jimrybarski / bad_map.py
Last active Jan 2, 2016
One of the worst pieces of code ever
View bad_map.py
""" I did not write this, though I fixed a syntax error in it. I just found it while looking for an easy way to plot a world choropleth map. It is probably the worst program I've ever seen and felt I should keep it for some reason. """
import shapefile
import matplotlib.cm as jimbo
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
import numpy as np
View mysql_secure.sh
#!/bin/bash
SECURE_MYSQL=$(expect -c "
set timeout 10
spawn mysql_secure_installation
expect \"Enter current password for root (enter for none):\"
send \"\r\"
View pedantically_commented_playbook.yml
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
You can’t perform that action at this time.