Skip to content

Instantly share code, notes, and snippets.

@swasher
swasher / del_empty
Last active October 17, 2016 10:44
del_empty
#!/bin/bash
# This script analyze directories in current directory,
# and delete all directories that smaller than "bytes" bytes
####### SETUP ############
# Max bytes for "empty" folder
bytes=1500000
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# bencode can be found here https://github.com/celend/bencode
import bencode
import os
import argparse
from zipfile import ZipFile
from datetime import datetime
from copy import deepcopy
#
# place it in indesign script folder
# this script can numbering table cells
#
var myCells = app.activeDocument.selection[0].cells;
for (i=0;i<myCells.length;i++){myCells[i].texts[0].contents = String(i+1);}
@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.
- 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 / 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"
@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 / 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 / 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 / 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)