- All pools' status:
zpool status - specific pools status:
zpool status pdata1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Save this in ~/.screenrc | |
| # Use bash | |
| shell /bin/bash | |
| autodetach on | |
| # Big scrollback | |
| defscrollback 5000 |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: |
Common lines of code in different languages for quick reference and comparison: Java, JavaScript, Kotlin, Objective-C, Python, Ruby, Scala, Swift.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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') |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(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 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |