Skip to content

Instantly share code, notes, and snippets.

@jmichelsen
jmichelsen / zfs_cheatsheet.md
Created November 21, 2025 18:37 — forked from thikade/zfs_cheatsheet.md
ZFS commands cheatsheet for snapshots etc

ZFS Pools

ZFS admin

  • All pools' status: zpool status
  • specific pools status: zpool status pdata1

Filesystems

@jmichelsen
jmichelsen / hashtag.py
Created October 6, 2019 17:11 — forked from mahmoud/hashtag.py
hashtag regex in python
import re
# the first group is noncapturing and just ensures we're at the beginning of
# the string or have whitespace before the hashtag (don't want to capture anchors)
# without the fullwidth hashmark, hashtags in asian languages would be tough
hashtag_re = re.compile("(?:^|\s)[##]{1}(\w+)", re.UNICODE)
@jmichelsen
jmichelsen / .screenrc
Created October 15, 2018 15:36 — forked from phawk/.screenrc
Sample screenrc
# Save this in ~/.screenrc
# Use bash
shell /bin/bash
autodetach on
# Big scrollback
defscrollback 5000
@jmichelsen
jmichelsen / flask_nginx_gunicorn.md
Created September 26, 2017 23:57 — forked from xaratustrah/flask_nginx_gunicorn.md
Flask nginx gunicorn Raspberry Pi

Python Flask + nginx + gunicorn

Setting up a python flask web application using nginx, gunicorn and systemd on a Rasperry Pi

In the following, we assume a working Flask application with the name of SCRIPT_NAME. First we need to install a couple of things:

sudo apt-get update && sudo apt-get upgrade

Installing nginx will fail if apache is running. If your installation breaks half ways, then remove the fragments, stop apache (and I actually suggest removing it in case not needed) and then install nginx again:

sudo apt-get remove nginx* --purge

sudo /etc/init.d/apache2 stop

class SlicerFieldMixin(object):
def get_slicer_data(self):
# this mixin will have access to self.get_object in the view. Use that to get your primary
# object, then fetch related stuff based on that primary
return DB.Slicer.get(monitor_id=self.object.id)
def fetch_related_fields(self):
related = super(SlicerFieldMixin, self).fetch_related_fields()
requested_fields = self.request.GET.get('fields', list())
for field in requested_fields:
@jmichelsen
jmichelsen / Code cheat sheet.md
Created March 20, 2017 04:18 — forked from fmaylinch/Code cheat sheet.md
Common lines of code in different languages for quick reference and comparison
@jmichelsen
jmichelsen / gist:b53cafc4d7c604c266fe
Created December 16, 2015 23:50 — forked from jorgeguberte/gist:1443051
Download album from Picasa with Python
import urllib
from xml.dom import minidom
'''
Opens an xml and parse it
Could fetch the xml from Picasa instead of fetching from the disk.
'''
print 'Fetching xml...'
sock = open('xml.xml')
@jmichelsen
jmichelsen / about.md
Created September 24, 2015 17:23 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@jmichelsen
jmichelsen / promises.js
Created September 4, 2015 05:06
An Example of Promises in JavaScript (JQuery)
$(document).on('click', '.mass-add-fields', function() {
$("td.active").find('.toggle').click();
var checkedOfferFormIds = [];
function checkedOffersWithoutForms() {
var $checkedOffers = $('.offer.checked').find('button[data-create="true"]'),
$promises = [],
d = $.Deferred();
if ( !$checkedOffers.length ) {
@jmichelsen
jmichelsen / 0_reuse_code.js
Created December 9, 2013 19:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console