Hint: it's not different than running it under ubuntu without Windows.
sudo apt install postgresql-common
sudo sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
# Try listing the processes associated with a term, for example guake. | |
$ pgrep guake | |
8494 | |
# Kill guake processes without bothering looking at them. | |
$ pkill guake |
# Encrypt file | |
gpg -c --cipher-algo AES256 private-file.txt | |
# Decrypt it | |
gpg private-file.txt.gpg | |
# !!Don't forget the passphrase!! |
# Source: https://makandracards.com/makandra/527-squash-several-git-commits-into-a-single-commit | |
# Switch to the master branch and make sure you are up to date. | |
git checkout master | |
git fetch # this may be necessary (depending on your git config) to receive updates on origin/master | |
git pull | |
# Merge the feature branch into the master branch. | |
git merge feature_branch |
// Get html collection of images: | |
var imgs = document.getElementsByTagName('img') | |
// Convert to array | |
imgs = Array.from(imgs) | |
// Map to urls | |
var urls = imgs.map(img => img.src) | |
// Copy to clipboard |
function MorseNode(ac, rate) { | |
// ac is an audio context. | |
this._oscillator = ac.createOscillator(); | |
this._gain = ac.createGain(); | |
this._gain.gain.value = 0; | |
this._oscillator.frequency.value = 750; | |
this._oscillator.connect(this._gain); |
In [1]: %load_ext autoreload | |
In [2]: %autoreload 2 | |
In [3]: from core.courses import questions | |
In [4]: questions.meaning_of_life() | |
Out[4]: 42 | |
In [5]: "Rewriting method" |
function query() { | |
var | |
// HN is done with very unsemantic classes. | |
job_list = Array.prototype.slice.call(document.querySelectorAll('.c5a,.cae,.c00,.c9c,.cdd,.c73,.c88')), | |
query_list = Array.prototype.slice.call(arguments), | |
shown = 0, total = job_list.length; | |
// Traverses up the dom stack trying to find a match of a specific class | |
function up_to(node, klass) { | |
if (node.classList.contains(klass)) { |
from django.utils import timezone | |
import pytz | |
pytz_tz = pytz.timezone('America/Chicago') | |
# wrong -- The direct approach leads to somewhat random time offsets between timezones. | |
adt = timezone.datetime(year=2016, month=1, day=6, tzinfo=pytz_tz) | |
# correct: Localize a naive datetime. | |
ndt = timezone.datetime(year=2016, month=1, day=6) |