Note: on legacy intel system the path may be /usr/local/etc/clamav instead of /opt/homebrew/etc/clamav/
$ brew install clamav
$ cd /opt/homebrew/etc/clamav/
$ cp freshclam.conf.sample freshclam.conf| After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
| The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
| Database files have to be updated before starting the server, here are the steps that had to be followed: | |
| # need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
| brew unlink postgresql | |
| brew install postgresql@9.6 | |
| brew unlink postgresql@9.6 | |
| brew link postgresql |
| # -*- coding: utf-8 -*- | |
| __author__ = "Stefan Kögl" | |
| from json import dumps, loads | |
| from google.appengine.api.urlfetch import fetch, POST | |
| def vision_api_web_detection(uri): |
Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.
This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would
| # coding: utf-8 | |
| # Imports | |
| import os | |
| import cPickle | |
| import numpy as np | |
| import theano | |
| import theano.tensor as T |
An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.
| import threading, os, logging | |
| from math import sqrt | |
| class threadsafe_iterator: | |
| def __init__(self, iterator): | |
| self.iterator = iterator | |
| self.lock = threading.Lock() | |
| def __iter__(self): |
| import os | |
| import logging | |
| from math import sqrt | |
| def generate_primes(number): | |
| logger = logging.getLogger(str(os.getpid()) + ':logger') | |
| for num in range(number + 1): | |
| # prime numbers are greater than 1 |
| find . | grep '\.py' | grep -v -e '/venv/' -e '(' -e ')' | xargs -I % grep import % | sed -e 's/^[ ]*//' | grep -e '^from ' -e '^import ' | awk '{print $2}' | sed -e 's/^[\.]*//' | cut -d\. -f1 | tr '[A-Z]' '[a-z]' | sort -bfd | uniq -c | sort -nr | head -20 |
| var di = function() { | |
| var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; | |
| var ARGUMENT_NAMES = /([^\s,]+)/g; | |
| var deps = {}; | |
| var getParamNames = function(func) { | |
| var fnStr = func.toString().replace(STRIP_COMMENTS, ''); | |
| var result = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); | |
| if(result === null) { |