Skip to content

Instantly share code, notes, and snippets.

@senderle
senderle / hand-modify-pdf.md
Created September 23, 2020 15:03
So you want to modify the text of a PDF by hand

So you want to modify the text of a PDF by hand...

If you, like me, resent every dollar spent on commercial PDF tools, you might want to know how to change the text content of a PDF without having to pay for Adobe Acrobat or another PDF tool. I didn't see an obvious open-source tool that lets you dig into PDF internals, but I did discover a few useful facts about how PDFs are structured that I think may prove useful to others (or myself) in the future. They are recorded here. They are surely not universally applicable --
the PDF standard is truly Byzantine -- but they worked for my case.

@hansrajdas
hansrajdas / vim.md
Last active July 21, 2024 04:40
VIM commands

Acronym

  • C-a ==> CTRL-a

Modes in VIM

  • Normal mode(n) When we open mode, the default mode is normal
  • Insert mode(i) When we want to insert some text, we press i, a or A etc to go in insert mode
  • Command mode(c) When we type colon(:) from normal mode, we enters command mode
  • Visual mode(v) Using v or V or C-i

Start VIM

@steven2358
steven2358 / ffmpeg.md
Last active July 22, 2024 08:40
FFmpeg cheat sheet
@liuyanghejerry
liuyanghejerry / index.html
Last active July 3, 2024 14:25
Modern index file in 2017
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#">
<head>
<!-- content-type, which overrides http equivalent header. Because of charset, this meta should be set at first. -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- Overrides http equivalent header. This tells IE to use the most updated engine. -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<!-- Tells crawlers how to crawl this page, and the role of this page. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta -->
<meta name="robots" content="index, follow">
@rafapereirabr
rafapereirabr / life_expect_world_map_gif.md
Last active November 15, 2020 06:31
creating an animated (gif) world map of life expectancy using ggplot2

This gist shows how to create an animated world map of life expectancy using R. The data comes the UN World Population Prospects, 2015 Revision, and it brings life expectancy data from 1950 untill 2015 and projeceted data up to 2100. Thanks Topi Tjukanov, who reminded me of the UN DESA data portal, where you can find this dataset and many others

The idea is to use open data to create a GIF, much like the ones created by Aron Strandberg but his maps look much nicer. The output of this script is a map like this one:

[![enter image description here][1]][1]

Now diving into the code. First, let's load the necessary libraries and get the data. As of this writing, the current version of gganimate has a bug that messes the aesthetics of the .gif file. As a temporary solution, I've intalled an older version of the package, [as recommended by the author of the gganimate, David Ro

@mattmattmatt
mattmattmatt / kodi-jsonp.js
Last active June 30, 2022 16:48
I had a hard time finding the documentation about the Kodi or XBMC JSONRPC API and how to make requests from a browser without running into CORS header problems. Kodi luckily supports JSONP-style requests. So if you can only make GET requests and want to circumvent CORS restrictions, use this JSONP snippet.
// npm i --save jsonp
import jsonp from 'jsonp';
var host = 'http://192.168.1.140';
var data = {
'jsonrpc': '2.0',
'method': 'Application.GetProperties',
'params': '[["volume","muted","version"]]',
'id': Math.ceil(Math.random() * 10000)
@cfxd
cfxd / gist:9ddbba4607ceec5a2a2e
Last active February 2, 2021 10:02
Install The CSS3 Font Converter (http://www.useragentman.com/blog/the-css3-font-converter/) on OS X Yosemite for on demand @font-face conversion on the command line. Also see http://cfxdesign.com/css3-font-converter-is-a-command-line-font-face-converter
1. $ brew install fontforge ttf2eot ttfautohint
2. $ brew tap bramstein/webfonttools && brew install sfnt2woff
3. Download/clone https://github.com/google/woff2 into any handy dir
cd into dir and:
$ git submodule init
$ git submodule update
$ make clean all
then: