Skip to content

Instantly share code, notes, and snippets.

View wswld's full-sized avatar
:octocat:
Busywork!

Vsevolod Glumov wswld

:octocat:
Busywork!
View GitHub Profile
@wswld
wswld / compress_pdf.md
Created July 19, 2020 06:37 — forked from ahmed-musallam/compress_pdf.md
How to compress PDF with ghostscript

How to compress PDF using ghostscript

As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!

to learn more abot ghostscript (gs): https://www.ghostscript.com/

What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.

credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9

@wswld
wswld / fibonacci.go
Created November 11, 2018 14:40
Tour of Go: Fibonacci Excercise
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
i := -1
f1 := 0
f2 := 1
@wswld
wswld / timelapsefrommp4.sh
Created November 17, 2017 03:24
Create a timelapse from mp4
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" -an output.mp4
@wswld
wswld / tail.sh
Created September 21, 2015 12:17
Watch logs continiously
tail -F
@wswld
wswld / logical.py
Last active August 29, 2015 14:26
Equating with logical operators in Python
>>> out = 'bar' or 'foo'
>>> out
'bar'
>>> bar = False
>>> out = bar or 'foo'
>>> out
'foo'
>>> bar = None
@wswld
wswld / list_unpacking.py
Created July 25, 2015 23:01
Unpacking List in Python
list = [[313, 135, 135], [735,468,795], [426,73468,26]]
print [x for l in list for x in l]
@wswld
wswld / preferences.py
Created July 20, 2015 14:19
Sublime Text Config
{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"rulers": [80, 120],
"tab_size": 4,
"translate_tabs_to_spaces": true,
"highlight_line": true,
"draw_white_space": "all",
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"shift_tab_unindent": true
@wswld
wswld / add_1080_xrandr_mode.sh
Last active August 29, 2015 14:20
Adding a new mode to second monitor.
xrandr --newmode "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -HSync +VSync
xrandr --addmode VGA1 "1920x1080"
xrandr --output VGA1 --mode 1920x1080
@wswld
wswld / build.py
Created April 28, 2015 10:11
Script for building every first-level subsection of the Sphinx project as separate PDF. Look here for details: http://wswld.net/2015/04/03/humble-collection-of-python-sphinx-gotchas-part-ii/
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import errno
import json
import argparse
import datetime
parser = argparse.ArgumentParser(description='Builds the documentation project.')