Skip to content

Instantly share code, notes, and snippets.

@zaemiel
zaemiel / gist:edfc6c176b2c9d210e3ebe02caa76834
Last active Oct 2, 2021
Gist to Django Vue.js deploy to remote server video
View gist:edfc6c176b2c9d210e3ebe02caa76834
1. To get IP address:
ip addr
2. To connect via SSH:
ssh username@ip_addr
@zaemiel
zaemiel / vue.config.js
Created Oct 1, 2021
vue.config.js for integrating with Django
View vue.config.js
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/static/dist/' : 'http://localhost:8080',
outputDir: '../backend/static/dist',
indexPath: '../../templates/base-vue.html',
chainWebpack: config => {
config.devServer
.public('http://localhost:8080')
View using-multiple-github-accounts-with-ssh-keys.md

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@zaemiel
zaemiel / vue.config.js
Created Nov 20, 2020
The minimal vue.config.js for django-webpack-loader and webpack-bundle-tracker
View vue.config.js
const BundleTracker = require('webpack-bundle-tracker');
module.exports = {
publicPath: "http://0.0.0.0:8080",
outputDir: "./dist/",
chainWebpack: config => {
config.optimization.splitChunks(false)
config.plugin('BundleTracker').use(BundleTracker, [
View gist:d6ffaccb0c316b68d6094e4d08e86508
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
'simple': {
'format': '%(levelname)s %(message)s'
@zaemiel
zaemiel / gist:0e7053ef5b135684be9a481b102ef390
Created Jul 20, 2018
Django pagination with bootstrap snippet
View gist:0e7053ef5b135684be9a481b102ef390
{% for n in posts.paginator.page_range %}
{% if posts.number == n %}
<li class="page-item active">
<span class="page-link">{{ n }}<span class="sr-only">(current)</span></span>
</li>
{% elif n > posts.number|add:'-2' and n < posts.number|add:'2' %}
<li class="page-item"><a class="page-link" href="?page={{ n }}">{{ n }}</a></li>
{% endif %}
@zaemiel
zaemiel / gist:411567c0a396e266ca4a412329f9f4ca
Created Apr 19, 2018
Nemo: How to open current folder in a terminal by a keyboard shortcut (Mint 18.x Cinnamon)
View gist:411567c0a396e266ca4a412329f9f4ca
1. Firstly, i have to create a .gnome2/accels/nemo file
cd .gnome2 (a hidden folder. If there is no one - create it)
mkdir accels
touch accels\nemo
2. Reboot system.
After rebooting the .gnome2/accels/nemo file will be filled with an autogenerated info.
3. Ctrl + F
View How to link Sublime Text Build system to Python 3
@zaemiel
zaemiel / CKEditor installation and integration with Active Admin
Last active Sep 28, 2020
CKEditor installation and integration with Active Admin
View CKEditor installation and integration with Active Admin
1. Gemfile
gem 'ckeditor', github: 'galetahub/ckeditor'
2. bundle install
3. app/assets/javascripts/application.js
//= require ckeditor/init
4. config/initializers/active_admin.rb
@zaemiel
zaemiel / CSS vertical align of text block within div
Last active Aug 29, 2015
CSS vertical align of text block within div
View CSS vertical align of text block within div
**A.) If you only have one line of text:**
HTML:
<div>vertically centered text</div>
CSS:
div
{