Skip to content

Instantly share code, notes, and snippets.

Dipesh Acharya xtranophilist

Block or report user

Report or block xtranophilist

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
xtranophilist / pass.ods
Created Jan 14, 2018
LibreOffice Calc random password geenrator
View pass.ods
=CONCAT(INT(RAND()*10), CHAR(48+RAND()*10), INT(RAND()*10),CHAR(65+RAND()*26),INT(RAND()*1000),CHAR(97+RAND()*26),INT(RAND()*1000))
xtranophilist /
Last active Oct 25, 2017
Saleor: Adding WYSIWYG to Product Description form in Dashboard

Install trumbowyg

yarn add trumbowyg

Edit saleor/static/dashboard/js/dashboard.js

import 'trumbowyg/dist/trumbowyg.min.js';
import 'trumbowyg/dist/ui/trumbowyg.min.css';
import icons from 'trumbowyg/dist/ui/icons.svg';
View 1-uptime
exec /usr/bin/uptime
xtranophilist / dj_pagination_bootstrap4.html
Created Apr 13, 2017
Bootstrap 4 pagination template (partial) for dj-pagination
View dj_pagination_bootstrap4.html
{% load i18n %}
{% if is_paginated %}
<nav aria-label="navigation" class="p-3">
<ul class="pagination">
{% if page_obj.has_previous %}
<li class="page-item">
<a href="?page={{ page_obj.previous_page_number }}" aria-label="Previous" class="page-link previous">
&lsaquo;&lsaquo; {% trans "Previous" %}
xtranophilist / imdb-getglue.js
Last active Apr 12, 2017
Opens up relative GetGlue Page for the current IMDB page
View imdb-getglue.js
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
xtranophilist / .zshrc
Last active Mar 3, 2017
My zsh aliases
View .zshrc
autoload colors
PS1="%~ %{%(#~$fg[red]~$fg[blue])%}%#%{$fg[default]%} "
alias ..='cd ..'
alias autopep='autopep8 --in-place --aggressive --aggressive'
alias c2f='xclip -o -selection c'
alias ch='cd /var/www/html'
alias cl="clear; ls"
alias cpr="rsync --progress -ravz" #copy with progressbar
xtranophilist /
Last active Jun 24, 2016
Django template tag to check to see if the currently logged in user belongs to one or more groups. Supports {% else %} block. Mod of to support multi-word group names (with single/double quotes, e.g. {% ifusergroup 'Store Keeper' %}).
from django import template
from django.template import resolve_variable, NodeList
from django.contrib.auth.models import Group
register = template.Library()
def ifusergroup(parser, token):
""" Check to see if the currently logged in user belongs to one or more groups
if [ ! -f sublime_text_3.tar.bz2 ]; then
curl -L "" -o "sublime_text_3.tar.bz2"
tar -xvjf sublime_text_3.tar.bz2
sudo cp -fr "sublime_text_3/sublime_text.desktop" "/usr/share/applications/sublime_text.desktop"
sudo sed -i 's/Icon=sublime-text/Icon=\/opt\/sublime_text\/Icon\/128x128\/sublime-text.png/g' /usr/share/applications/sublime_text.desktop
rm -rf /opt/sublime_text
xtranophilist /
Last active Dec 30, 2015
DemocracyOS on Centos

This is a manual for installing DemocracyOS app in CentOS.

Setting up the Requirements

  1. MongoDB =========== Installing MongoDB and starting its daemon:
xtranophilist /
Last active Dec 23, 2015
Conditional Django template tag to check if one or more apps exist. Usage: {% ifappexists tag %} ... {% endifappexists %}, or {% ifappexists tag inventory %} ... {% else %} ... {% endifappexists %}
from django.template import Library
from django import template
from app import settings
register = Library()
def ifappexists(parser, token):
""" Conditional Django template tag to check if one or more apps exist.
You can’t perform that action at this time.