Skip to content

Instantly share code, notes, and snippets.

View wout's full-sized avatar
🕳️

Wout wout

🕳️
View GitHub Profile
@wout
wout / gist:a92ceb50716586a6e62f
Last active August 29, 2015 14:02
Round path directives to a given amount of decimals
// 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
@wout
wout / gist:df49798c8eeaff3cdede0013f5f14a24
Created January 21, 2019 10:31
Dell XPS 13 won't suspend
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 17:24 — forked from dfontana/CmderZSH.md
My setup guide for installing Cgywin, Mintty, Cmder, and ZSH.

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
** (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 July 2, 2020 19:22 — forked from hopsoft/prefetch.js
Turbolinks Prefetching
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 = () => {
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
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
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)
@wout
wout / README.md
Created September 26, 2020 13:31 — forked from julienma/README.md
How to install Discourse 2.4+ on Dokku (2019)
@wout
wout / sitemap.xml
Last active October 1, 2020 08:02
TiLiShop Bridgetown Sitemap Example
---
layout: false
permalink: "/sitemap.xml"
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://tilishop.com/</loc>
</url>
<url>