Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki
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
| # coding: utf-8 | |
| # In[1]: | |
| get_ipython().magic('matplotlib inline') | |
| import matplotlib.pyplot as plt | |
| import numpy as np |
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
| # remove all files in the current directory with 'copy' in the name | |
| ls | grep .*copy | xargs rm | |
| # remove files - works with whitespace in filename | |
| find -type f -name '*.sql' -mtime +15 -print0 | xargs -0 rm | |
| # replace white space in file names with underscore | |
| for f in *\ *; do mv "$f" "${f// /_}"; done |
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
| export default function f_promisified(x) { | |
| return new Promise((resolve, reject) => { | |
| f(x, (err, res) => { | |
| if(err) { | |
| reject(err.stack); | |
| } | |
| else { | |
| resolve(res); | |
| } | |
| }); |
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 pika | |
| import sys | |
| import pyCommon.data.serialize as serialize | |
| import pyCommon.net.command as cmd | |
| import pyCommon.net.event as evt | |
| queueName = sys.argv[1] | |
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
| # stop | |
| sudo systemctl stop serial-getty@ttyAMA0.service | |
| # disable | |
| sudo systemctl disable serial-getty@ttyAMA0.service | |
| # set baud | |
| stty -F /dev/ttyAMA0 9600 |
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
| // https://github.com/thrashr888/mathr | |
| /** | |
| * @jsx React.DOM | |
| */ | |
| 'use strict'; | |
| var React = require('react/react.js'); |
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
| // taken from http://stackoverflow.com/questions/1922040/resize-an-image-c-sharp | |
| // user: Mark | |
| /// <summary> | |
| /// Resize the image to the specified width and height. | |
| /// </summary> | |
| /// <param name="image">The image to resize.</param> | |
| /// <param name="width">The width to resize to.</param> | |
| /// <param name="height">The height to resize to.</param> | |
| /// <returns>The resized image.</returns> |
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 pandas as pd | |
| import numpy as np | |
| # initial data frame | |
| # looks like: | |
| # | |
| # >>> df | |
| # | |
| # A B C D |
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
| // from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | |
| function MyError(message) { | |
| this.name = 'MyError'; | |
| this.message = message || 'Default Message'; | |
| } | |
| MyError.prototype = Object.create(Error.prototype); | |
| MyError.prototype.constructor = MyError; | |
NewerOlder