Skip to content

Instantly share code, notes, and snippets.

@brenopolanski
brenopolanski / merge-pdf-ghostscript.md
Last active May 2, 2024 06:56
Merge multiple PDFs using Ghostscript

A simple Ghostscript command to merge two PDFs in a single file is shown below:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

Install Ghostscript:

Type the command sudo apt-get install ghostscript to download and install the ghostscript package and all of the packages it depends on.

@maxlapshin
maxlapshin / capture_raw_frames.c
Created September 30, 2011 11:50
v4l2 capture example
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
*
* This program is provided with the V4L2 API
* see http://linuxtv.org/docs.php for more information
*/
#include <stdio.h>
@attacus
attacus / riot-matrix-workshop.md
Last active March 13, 2024 00:16
Create your own encrypted chat server with Riot and Matrix

This guide is unmaintained and was created for a specific workshop in 2017. It remains as a legacy reference. Use at your own risk.

Running your own encrypted chat service with Matrix and Riot

Workshop Instructor:

This workshop is distributed under a CC BY-SA 4.0 license.

What are we doing here?

@Papierkorb
Papierkorb / 000_HOWTO.md
Last active March 9, 2024 17:59
Dynamic library in Crystal

Writing a dynamic library in Crystal, and calling it from C

  • Download all files.
  • Build the Crystal part:
crystal build --release --cross-compile --prelude ./no_main library.cr
              ^ You can leave this out
                        ^ We want to link ourselves!
 ^ Use our custom prelude!
@StaticRocket
StaticRocket / rapid-clone.sh
Last active October 13, 2023 00:19
Quickly backup and deploy bootable SD cards with variable size ext4 root partitions
#!/bin/sh
[ -z "$PART_PREFIX" ] && PART_PREFIX=''
DD_ARGS='status=progress conv=fsync'
backup() {
src="$1"
dst="$2"
sfdisk -d "${src}" > "${dst}-table.txt"
@sevastos
sevastos / aws-multipartUpload.js
Last active October 8, 2023 10:43
Example AWS S3 Multipart Upload with aws-sdk for Node.js - Retries to upload failing parts
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload
var fs = require('fs');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./aws-config.json');
var s3 = new AWS.S3();
// File
var fileName = '5.pdf';
var filePath = './' + fileName;
var fileKey = fileName;
@johnantoni
johnantoni / startup_mailer.py
Created December 31, 2013 16:21
raspberry pi - send email on startup (will need gmail account to send from)
import subprocess
import smtplib
import socket
from email.mime.text import MIMEText
import datetime
# Change to your own account information
to = 'me@example.com'
gmail_user = 'test@gmail.com'
gmail_password = 'yourpassword'
smtpserver = smtplib.SMTP('smtp.gmail.com', 587)
@j8r
j8r / compile-crystal-arm64.sh
Last active April 27, 2023 17:59
Compile a Crystal program to a statically linked arm64 binary
#!/bin/sh -eu
LOCAL_PROJECT_PATH=${1-$PWD}
BUILD_COMMAND="
shards build --static --release
chown 1000:1000 -R bin
"
INSTALL_CRYSTAL="
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' >>/etc/apk/repositories
apk add --update --no-cache --force-overwrite \
@pdp7
pdp7 / BB-SPIDEV1-00A0.dts
Last active January 8, 2023 16:59
src/arm/BB-SPIDEV1-00A0.dts modify to add tinydrm st7735r for Adafruit 1.8" TFT LCD connected to BeagleBone Black running 4.16.0-rc2-bone3 kernel. More info: https://groups.google.com/d/msg/beagleboard/GuMQIP_XCW0/b3lxbx_8AwAJ
/*
* Copyright (C) 2013 CircuitCo
*
* Virtual cape for SPI1 on connector pins P9.29 P9.31 P9.30 P9.28
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
@walchko
walchko / mjpeg2.py
Last active August 21, 2022 23:31
a better mjpeg streamer in python using opencv 3.x
#!/usr/bin/env python3
# MIT License
# (c) 2017 Kevin J. Walchko
#
# Updated 16 Mar 2020: Python 3.7.5 Ubuntu 19.10
# Desktop, wired interface is enp2s0
# Raspberry Pi: wlan0
# Ideally, this should be fixed, it is hard coded right now