Skip to content

Instantly share code, notes, and snippets.

View rempargo's full-sized avatar
💭
Working

Paul Verschoor rempargo

💭
Working
  • www.pixelhobby.com
  • Wervershoof
View GitHub Profile
@rempargo
rempargo / my_first_gist_file.rb
Created June 13, 2012 06:15
Some gist description
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
$('div').text('The code to show this text was loaded from a different server, this remote script, instructed to update all the div\'s');
#!/usr/bin/env ruby -wKU
require "rubygems"
require "appscript"
include Appscript
chrome = app("Google Chrome")
safari = app("Safari")
chrome_tab = chrome.windows[1].active_tab
@rempargo
rempargo / chunkypixel_average.rb
Last active August 31, 2015 13:05 — forked from darkleo/chunkypixel_average.rb
Pixelizing images with ChunkyPNG
#! usr/bin/env ruby
require 'chunky_png'
class ChunkyPNG::Image
# s: Integer (pixel size)
def pixelize s = 10
temp = Array.new((height*1.0/s).ceil) {Array.new((width*1.0/s).ceil) {Array.new(3) {0}}}
height.times {|j| width.times {|i| ChunkyPNG::Color.to_truecolor_bytes(get_pixel(i,j)).each.with_index {|e,k| temp[j/s][i/s][k] += e}}}
png = ChunkyPNG::Image.new width, height
sq = s**2
@rempargo
rempargo / bassie.png
Last active August 31, 2015 13:05 — forked from jeffkreeftmeijer/bassie.png
ChunkyPNG nearest-neighbor resize
bassie.png
@rempargo
rempargo / nginx_parser_log.rb
Created November 6, 2018 20:40 — forked from fidelisrafael/nginx_parser_log.rb
Nginx Logger Parser for Ruby
require 'pry'
require 'json'
require 'uri'
module Application
class NginxLogParser
DEFAULT_FORMAT_REGEXP = /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s?\-\s?-\s?\[(\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\]\s?\\?"?(GET|POST|PUT|HEAD|DELETE|OPTIONS)\s?(.*?)\s(HTTP\/\d\.\d)\\?"?\s?(\d{3})\s?(\d+)\s?\\?\"\-\\?\"\s?\\?\"(.*?)\"/i
REQUEST_FORMAT = [
@rempargo
rempargo / install_CUPS_all_defaults.sh
Last active December 8, 2018 15:25 — forked from aweijnitz/install_CUPS_all_defaults.sh
Installing CUPS printer on Debian and add PDF printer
#!/bin/bash
sudo apt-get -y install cups
sudo apt-get -y install cups-pdf
# add pdf printer to cups
# - named files end up in ~/PDF/
# - unnamed files are stored in /var/spool/cups-pdf/ANONYMOUS/, such as PDF:s created by streaming bytes over an API
sudo lpadmin -p cups-pdf -v cups-pdf:/ -E -P /usr/share/ppd/cups-pdf/CUPS-PDF.ppd
@rempargo
rempargo / readme.md
Created December 3, 2018 09:36 — forked from coderbyheart/readme.md
QL-720NW

QL-720NW printing with Arch Linux (32-Bit)

brother-ql720nw-lpr

PKGBUILD

# Maintainer:  Markus Tacker <m@cto.hiv>
# Based on the QL-700 PKGBUILD -> Jacob Alexander <triplehaata@gmail.com>
pkgname=brother-ql720nw-lpr

pkgver=1.0.1

@rempargo
rempargo / color-conversion-algorithms.js
Created June 15, 2019 14:20 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@rempargo
rempargo / flashair-download.sh
Last active December 16, 2020 11:56 — forked from seidler2547/flashair-download.sh
Script to download all pictures from a FlashAir SD card in STA mode to a specific folder on the hard drive
#!/bin/bash
# you might need cadaver
# brew install cadaver
IPADDR=192.168.39.171
TARGETFOLDER=~/Desktop/machine_1
while :; do