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.

@willianbs
willianbs / simple-docker-apache-php
Created August 26, 2019 17:18
Simple Docker Apache+PHP local dev in the current dir
docker run -d -p 8082:80 --mount type=bind,source="$(pwd)",target=/var/www/html php:apache
// That's it! If you try this, and it works for you, you're done!
// The command does the following:
// If the Docker image php:apache is not present in your machine's local Docker registry, it will be downloaded from Docker hub.
// It creates a new container based on the image php:apache.
// It maps port 80 from the container to port 8082 on your host machine.
// It mounts the current directory from your host machine to /var/www/html in the container.
@tamask
tamask / log.py
Created August 8, 2018 00:44
Route system output (stdout/stderr) of Blender to the app console (put in scripts/startup)
import os
import sys
import bpy
output = None
input = None
info = None
error = None
write = None
// To install as a global sbt plugin, place this file in:
// ~/.sbt/1.0/plugins/Semanticdb.scala
// ~/.sbt/0.13/plugins/Semanticdb.scala
// To use it, run `sbt semanticdb`. This will first enable the semanticdb
// compiler plugin for modules that have a compatible scala version and then
// trigger compilation for those projects.
import sbt._
import sbt.Keys._
import sbt.plugins.JvmPlugin
@zuyu
zuyu / ubuntu-install-gcc-6
Last active April 25, 2024 19:48
Install gcc 6 on Ubuntu
sudo apt update && \
sudo apt install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt update && \
sudo apt install gcc-6 g++-6 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
gcc -v
@oowekyala
oowekyala / README.md
Last active August 6, 2019 13:05
GSoC 2017 report -- Bringing Object-Oriented Metrics to PMD
@Storm-BE
Storm-BE / ArgumentValidation.cs
Created July 7, 2017 06:16
ArgumentValidation
using System;
using JetBrains.Annotations;
namespace Helpers
{
public static class ArgumentValidation
{
public static void ThrowIfNull<T>([ValidatedNotNull] [NoEnumeration] T argument)
where T : class
{
@straker
straker / README.md
Last active April 20, 2024 10:20
Basic Snake HTML and JavaScript Game

Basic Snake HTML and JavaScript Game

Snake is a fun game to make as it doesn't require a lot of code (less than 100 lines with all comments removed). This is a basic implementation of the snake game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

  • Score
  • When the snake eats an apple, the score should increase by one. Use context.fillText() to display the score to the screen
@joshuashaffer
joshuashaffer / pointTriangleDistance.py
Created July 1, 2015 22:28
Computes the distance between a point an triangle. Python.
#!/usr/bin/env python
#
# Tests distance between point and triangle in 3D. Aligns and uses 2D technique.
#
# Was originally some code on mathworks
import numpy
from numpy import dot
from math import sqrt
@protrolium
protrolium / ffmpeg.md
Last active April 8, 2024 11:49
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with: