Skip to content

Instantly share code, notes, and snippets.

@bre7
bre7 / DeviceUID.m
Last active August 29, 2015 14:23 — forked from miguelcma/DeviceUID.m
/* DeviceUID.h
#import <Foundation/Foundation.h>
@interface DeviceUID : NSObject
+ (NSString *)uid;
@end
*/
// Device.m
@bre7
bre7 / Direct_Links_in_Google_Search.user.js
Created May 4, 2017 21:04 — forked from astanin/Direct_Links_in_Google_Search.user.js
Remove indirections from Google search results on all TLDs (GreaseMonkey script)
$(document).ready(function() {
$.waypoints.settings.scrollThrottle = 30;
$('#main').waypoint(function(event, direction){
/* Just as we have a sticky class applied when we hit the top waypoint,
we'll have a different class applied when we bottom out */
if (direction === 'down') {
$(this).removeClass('sticky').addClass('bottomed');
}
else {
$(this).removeClass('bottomed').addClass('sticky');
$(document).ready(function() {
$.waypoints.settings.scrollThrottle = 30;
$('#main').waypoint(function(event, direction){
/* Just as we have a sticky class applied when we hit the top waypoint,
we'll have a different class applied when we bottom out */
if (direction === 'down') {
$(this).removeClass('sticky').addClass('bottomed');
}
else {
$(this).removeClass('bottomed').addClass('sticky');
@bre7
bre7 / upload-github-release-asset.sh
Created April 11, 2018 21:18 — forked from stefanbuck/upload-github-release-asset.sh
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
@bre7
bre7 / compress_pdf.md
Created July 5, 2018 19:35 — 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

@bre7
bre7 / README.md
Created November 8, 2018 01:54 — forked from hubgit/README.md
Remove metadata from a PDF file, using exiftool and qpdf. Note that embedded objects may still contain metadata.

Anonymising PDFs

PDF metadata

Metadata in PDF files can be stored in at least two places:

  • the Info Dictionary, a limited set of key/value pairs
  • XMP packets, which contain RDF statements expressed as XML

PDF files

@bre7
bre7 / made-with-love.html
Created March 31, 2021 17:51 — forked from oliveratgithub/made-with-love.html
Various snippets to add "Made with love" to your website using HTML, CSS and JavaScript
<!-- Example #1 - no styling -->
Made with ❤ in Switzerland
Made with ♥ in Switzerland
Made with ♡ in Switzerland
Made with ❤️ in Switzerland
Made with ♥️ in Switzerland
<!-- Example #2 - inline-styled ❤ -->
Made with <span style="color: #e25555;">&#9829;</span> in Switzerland
Made with <span style="color: #e25555;">&hearts;</span> in Switzerland
@bre7
bre7 / Apps Script pdfToText utility.md
Created June 13, 2021 13:59 — forked from mogsdad/Apps Script pdfToText utility.md
For http://stackoverflow.com/questions/26613809, a question about getting pdf attachments in gmail as text. I got a little carried away - this does much more than asked.

Google Apps Script pdfToText Utility#

This is a helper function that will convert a given PDF file blob into text, as well as offering options to save the original PDF, intermediate Google Doc, and/or final plain text files. Additionally, the language used for Optical Character Recognition (OCR) may be specified, defaulting to 'en' (English).

Note: Updated 12 May 2015 due to deprecation of DocsList. Thanks to Bruce McPherson for the getDriveFolderFromPath() utility.

    // Start with a Blob object
    var blob = gmailAttchment.getAs(MimeType.PDF);
    
@bre7
bre7 / watermark_with_image.rb
Created June 16, 2021 17:33 — forked from adityashedge/watermark_with_image.rb
Watermark images with ImageMagick 'convert' using 'composite', 'watermark' and 'dissolve' in Ruby
# Watermarking image with another image using Imagemagick 'composite', 'watermark' and 'dissolve'.
require "RMagick"
# Read the image in the memory with RMagick
img = Magick::Image.read("/home/aditya/Pictures/old_england_pic.jpg").first
# the original image was in jpg format
# need to make the white background color transparent
# also changed the format to png since JPG does not support transparency.
# run the command below to create an image with transparent background using ImageMagick