Skip to content

Instantly share code, notes, and snippets.

@onlyphantom
onlyphantom / docker-volumes.md
Last active April 2, 2024 20:49
Demystifying Docker Volumes for Mac and PC Users

Demystifying Docker Volumes for Mac and PC Users

  1. Docker runs on a Linux kernel

Docker can be confusing to PC and Windows users because many tutorials on that topic assume you're using a Linux machine.

As a Linux user, you learn that Volumes are stored in a part of the host filesystem managed by Docker, and that is /var/lib/docker/volumes. When you're running Docker on a Windows or Mac OS machine, you will read the same documentation and instructions but feel frustrated as that path don't exist on your system. This simple note is my answer to that.

When you use Docker on a Windows PC, you're typically doing one of these two things:

  • Run Linux containers in a full Linux VM (what Docker typically does today)
@DoonDoony
DoonDoony / pycharm_python_console_shell_plus_script.py
Last active January 20, 2024 15:50
Using `shell_plus` in pycharm django console
# 💡 NOTE: This only works if you are pretend to using `Django Console` feature in Pycharm
# Paste codes below into `Build, Execution, Deployment > Console > Django Console > Starting Script`
# requirements: `django_extensions`, `IPython`
import sys
import django
from IPython.core.getipython import get_ipython
from django_extensions.management.notebook_extension import load_ipython_extension
@nathandem
nathandem / pdf.py
Last active February 7, 2022 08:23
Arbitrary header/footer integration in Weasyprint PDF pages
from weasyprint import HTML, CSS
class PdfGenerator:
"""
Generate a PDF out of a rendered template, with the possibility to integrate nicely
a header and a footer if provided.
Notes:
------
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
import * as fb from "firebase";
import { computed, observable, runInAction } from "mobx";
type Query = fb.firestore.Query;
type DocumentReference = fb.firestore.DocumentReference;
type DocumentSnapshot = fb.firestore.DocumentSnapshot;
type LoadingDocumentSnapshot = DocumentSnapshot | undefined;
type Dictionary<T> = { [key: string]: T };
// type QuerySnapshot = fb.firestore.QuerySnapshot;
// type LoadingCollectionSnapshot = QuerySnapshot | undefined;
@henriquemenezes
henriquemenezes / postgresql-set-id-seq.sql
Created March 31, 2016 12:23
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active October 21, 2022 20:10
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@raelgc
raelgc / Install MSOffice on Ubuntu.md
Last active February 26, 2024 03:10
Install MSOffice on Ubuntu

Install Microsoft Office 2010 on Ubuntu

Requirements

We'll install MSOffice using the PlayOnLinux wizard. Additionally, MSOffice requires samba and winbind to properly work.

So, if not installed, install them:

sudo apt-get install playonlinux samba winbind
@kuntoaji
kuntoaji / progress_bar.rb
Created September 6, 2013 06:54
Simple progress bar script without Gem using Ruby.
#!/usr/bin/env ruby
progress = 'Progress ['
1000.times do |i|
# i is number from 0-999
j = i + 1
# add 1 percent every 10 times
if j % 10 == 0
@wikimatze
wikimatze / gist:6332795
Last active December 21, 2015 16:19
Bring padrino to the next level

I recently had the pleasure to meet Darío at eurucamp 2013 in wonderful Berlin to discuss issues with the further development of Padrino. Here are the following points we need to think over.

Handling Mailing List

As recently posted on our mailing list with the sql problem, we have problems with some posted activities which are not shown up on the page. Apparently, we I can't find the post anymore which mentioned this issue.

Questions needs to be answered:

  • Who is responsible to admin the presence (checking options, help new members with registration)
  • Should all main contributors have access to the settings?