Skip to content

Instantly share code, notes, and snippets.

zsh starting in current directory
Tools -> Terminal -> Environment variables ---> CHERE_INVOKING=1
@swasher
swasher / gist:324263d83b7c5e1cd0aace2065b6d7ac
Created January 10, 2023 10:36
How add Zoom feature to Hugo PaperMod
<!-- Just save this file to hugo's -->
<!-- layouts/partials/extend_footer.html -->
<!-- That's all! -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/medium-zoom/1.0.6/medium-zoom.min.js" integrity="sha512-N9IJRoc3LaP3NDoiGkcPa4gG94kapGpaA5Zq9/Dr04uf5TbLFU5q0o8AbRhLKUUlp8QFS2u7S+Yti0U7QtuZvQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
const images = Array.from(document.querySelectorAll(".post-content img"));
images.forEach(img => {
mediumZoom(img, {
@swasher
swasher / Share project on github
Created December 5, 2022 07:43
Share project on github
#
# First create new project on github site. Then:
#
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/yourUsername/yourRepository.git
git push -u origin master
git push origin master
@swasher
swasher / gist:d2369bf04f46e5eff5d531399877a4bc
Created March 12, 2019 14:56
Compile Adobe Spectrum CSS
Install nvm
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
Check nvm
$ nvm --version
Find node version
$ nvm ls-remote | grep Latest
v4.9.1 (Latest LTS: Argon)
v6.17.0 (Latest LTS: Boron)
@swasher
swasher / messages.html
Last active July 19, 2017 20:19 — forked from DmytroLitvinov/messages.html
[Django middleware for AJAX messages] Middleware for JSON responses. It adds to each JSON response array with messages from django.contrib.messages framework. It allows handle messages on a page with javascript. Django 1.10. #tags: django, python, ajax
<div id="messages">
{% for message in messages %}
<div {% if message.tags %}class="alert alert-dismissable alert-{{ message.tags }}"{% endif %}>
<a class="close" data-dismiss="alert" href="#">&times;</a>
{{ message }}
</div>
{% endfor %}
</div>
@swasher
swasher / Acrobat reverse page orders
Created July 7, 2016 13:31
Acrobat reverse page orders
// Put this into C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Javascripts
app.addMenuItem({ cName: "Reverse", cParent: "View", cExec: "PPReversePages();", cEnable: "event.rc = (event.target != null);", nPos: 0
});
function PPReversePages()
{
var t = app.thermometer;
t.duration = this.numPages;
t.begin();
@swasher
swasher / install.sh
Last active April 10, 2016 09:08
Script for apply ansible role
#!/usr/bin/env bash
# install pip
curl -s https://bootstrap.pypa.io/get-pip.py | sudo python -
# add path for install ansible in user mode (otherwise it can't start because not it PATH)
echo "export PATH=$PATH:$HOME/.local/bin" >> .bashrc
export PATH=$PATH:$HOME/.local/bin
# install ansible
@swasher
swasher / Vagrantfile
Last active July 30, 2016 13:22
Vagrantfile for setting up Django's Vagrant container
# -*- mode: ruby -*-
# vi: set ft=ruby :
internal_ip = "172.28.128.4"
project_name = "blog"
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
- Install latest Wine and Winetricks
$ sudo add-apt-repository ppa:joe-yasi/yasi
$ sudo add-apt-repository ppa:ubuntu-wine/ppa
$ sudo apt-get update
$ sudo apt-get install wineX.X winetricks
- Install all the extra’s and default fonts using Wintricks CLI
$ winetricks corefonts eufonts lucida opensymbol tahoma cjkfonts
@swasher
swasher / AI2PDF.jsx
Last active October 22, 2020 02:38
Batch save-as AI to PDF with Black Overprint
/**********************************************************
Export to PDFs.jsx
DESCRIPTION
This sample gets files specified by the user from the
selected folder and batch processes them and saves them
as PDFs.