Skip to content

Instantly share code, notes, and snippets.

Avatar
👅

Wout wout

👅
View GitHub Profile
@wout
wout / gist:5188265
Created Mar 18, 2013
Zoom in and out with svg viewbox for http://svgjs.com
View gist:5188265
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>svg.js</title>
<style type="text/css" media="screen">
#buttons {
position: absolute;
right: 0;
@wout
wout / gist:6352742
Created Aug 27, 2013
Textflow plugin for svg.js
View gist:6352742
// svg.textflow.js 0.8 - Copyright (c) 2013 Wout Fierens - Licensed under the MIT license
SVG.Textflow = function() {
this.constructor.call(this, SVG.create('text'))
/* define default style */
this.styles = {
'font-size': 16
, 'font-family': 'Helvetica, Arial, sans-serif'
, 'text-anchor': 'start'
@wout
wout / gist:a92ceb50716586a6e62f
Last active Aug 29, 2015
Round path directives to a given amount of decimals
View gist:a92ceb50716586a6e62f
// svg.compress.js 0.0.1 - Copyright (c) 2014 Wout Fierens - Licensed under the MIT license
SVG.extend(SVG.Path, {
// Round path directives to a given amount of decimals
compress: function(decimals) {
decimals = eval('1e' + decimals)
for (var n, i = this.array.value.length - 1; i >= 0; i--)
for (n = this.array.value[i].length - 1; n >= 1; n--)
this.array.value[i][n] = ~~(this.array.value[i][n] * decimals) / decimals
View gist:df49798c8eeaff3cdede0013f5f14a24
Jan 21 11:19:25 rossy NetworkManager[1402]: <info> [1548065965.3426] manager: sleep: sleep requested (sleeping: no enabled: yes)
Jan 21 11:19:25 rossy NetworkManager[1402]: <info> [1548065965.3428] device (B4:8B:19:6B:0E:38): state change: disconnected -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Jan 21 11:19:25 rossy NetworkManager[1402]: <info> [1548065965.3431] manager: NetworkManager state is now ASLEEP
Jan 21 11:19:25 rossy NetworkManager[1402]: <info> [1548065965.3433] device (wlp2s0): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed')
Jan 21 11:19:25 rossy /usr/lib/gdm3/gdm-x-session[3112]: (II) event13 - ELAN24EE:00 04F3:24EE: device removed
Jan 21 11:19:25 rossy gnome-shell[3267]: + combinators are not supported
Jan 21 11:19:25 rossy gnome-shell[3267]: + combinators are not supported
Jan 21 11:19:25 rossy NetworkManager[1402]: <info> [1548065965.3761] device (wlp2s0): state change: deactivating -> disconnected (reason 'sleeping', sys-iface-st
@wout
wout / CmderZSH.md
Created May 26, 2019 — forked from dfontana/CmderZSH.md
My setup guide for installing Cgywin, Mintty, Cmder, and ZSH.
View CmderZSH.md

What's this?

Instructions to obtain ZSH on a windows environment, without the input funny business presented by some other attempted solutions.

The final result is ZSH running on a mintty terminal, emulated by cygwin, and being handled by the popular cmder.

Why is this here?

For the benefit of myself and others. I've already followed these instructions twice. It took me hours to figure all this out, maybe someone else can save a few.

What exactly is covered?

  • Installing and setting up cmder
View elementary OS AppCenter debug
** (process:2152): DEBUG: 08:43:35.748: ScreenshotCache.vala:18: screenshot path is at /home/wout/.cache/io.elementary.appcenter/screenshots
(io.elementary.appcenter:2152): Gtk-DEBUG: 08:43:35.790: Connecting to session manager
** (io.elementary.appcenter:2152): DEBUG: 08:43:35.794: Client.vala:114: update cache called false
** (io.elementary.appcenter:2152): DEBUG: 08:43:35.794: Client.vala:161: Too soon to refresh and not forced
(io.elementary.appcenter:2152): PackageKit-DEBUG: 08:43:35.795: notify::connected
(io.elementary.appcenter:2152): PackageKit-DEBUG: 08:43:35.821: notify::connected
** (io.elementary.appcenter:2152): DEBUG: 08:43:35.822: Opening cache file: /home/wout/.cache/appstream-cache-YJJIK0.mdb
** (io.elementary.appcenter:2152): DEBUG: 08:43:35.823: Added /usr/share/app-info/yaml to YAML metadata search path.
** (io.elementary.appcenter:2152): DEBUG: 08:43:35.823: Added /var/lib/app-info/yaml to YAML metadata search path.
@wout
wout / prefetch.js
Created Jul 2, 2020 — forked from hopsoft/prefetch.js
Turbolinks Prefetching
View prefetch.js
const hoverTime = 400
const fetchers = {}
const doc = document.implementation.createHTMLDocument('prefetch')
function fetchPage (url, success) {
const xhr = new XMLHttpRequest()
xhr.open('GET', url)
xhr.setRequestHeader('VND.PREFETCH', 'true')
xhr.setRequestHeader('Accept', 'text/html')
xhr.onreadystatechange = () => {
View Ruby OpenSSL: Verify Signature Example.rb
require 'openssl'
def verify_sign(key, signature, data)
# Verifies with a public key that the data was signed with their private key
pubkey = key.public_key
if pubkey.verify(OpenSSL::Digest::SHA256.new, signature, data)
puts 'the signature is valid'
else
puts 'the signature is invalid'
end
end
View Ruby OpenSSL: Verify Signature Example.rb
require 'openssl'
def verify_sign(key, signature, data)
# Verifies with a public key that the data was signed with their private key
pubkey = key.public_key
if pubkey.verify(OpenSSL::Digest::SHA256.new, signature, data)
puts 'the signature is valid'
else
puts 'the signature is invalid'
end
end
View payconiq-jwk-to-pem.rb
require 'jose'
require 'faraday'
require 'fast_jsonparser'
endpoint = 'https://ext.payconiq.com/certificates'
kid = 'es.signature.ext.payconiq.com'
response = Faraday.get(endpoint, {}, { 'Accept' => 'application/json' })
keys = FastJsonparser.parse(response.body).dig(:keys)