Skip to content

Instantly share code, notes, and snippets.

View vivien's full-sized avatar

Vivien Didelot vivien

  • Montréal
View GitHub Profile
@vivien
vivien / timezone.rb
Last active August 29, 2015 13:57
Script to toggle timezones in i3blocks
#!/bin/ruby
#
# Toggle timezones in i3blocks
# Author: Vivien Didelot <vivien.didelot@gmail.com>
#
# Fill the ZONES array and define a block like this:
#
# [timezone]
# command=THIS_SCRIPT
# interval=5
@vivien
vivien / weather.ca.sh
Created March 13, 2014 19:50
i3blocks script for weather in Canada
#!/bin/sh
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@vivien
vivien / i3-msg-subscribe.patch
Created October 7, 2014 04:17
i3-msg hack to implement the "SUBSCRIBE" message type
diff --git a/i3-msg/main.c b/i3-msg/main.c
index 354e8af..a1af25c 100644
--- a/i3-msg/main.c
+++ b/i3-msg/main.c
@@ -124,16 +124,18 @@ int main(int argc, char *argv[]) {
uint32_t message_type = I3_IPC_MESSAGE_TYPE_COMMAND;
char *payload = NULL;
bool quiet = false;
+ bool monitor = false;
@vivien
vivien / openmw.ini
Last active August 29, 2015 14:11
i3blocks bocklet to fetch the latest OpenMW version and progress percentage
[openmw]
command=curl -s https://gist.githubusercontent.com/vivien/7535f85928558fffb11d/raw/openmw.rb | ruby
interval=3600
@vivien
vivien / ipaddr.sh
Created January 9, 2015 06:11
ip address blocklet
#!/bin/bash
# use the provided interface, otherwise the first default device
if [[ -n $BLOCK_INSTANCE ]]
then
IF=$BLOCK_INSTANCE
else
IF=$( ip route | awk '/^default/ { print $5 ; exit }' )
fi
From 87d6bfd5fe53c64ab2f3bb860484d741dc9b5572 Mon Sep 17 00:00:00 2001
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Wed, 14 Jan 2015 18:55:45 -0500
Subject: [PATCH] net: dsa: review hwmon attributes visibility
Instead of setting a minimal mode for the temp_max sysfs attribute and
adding write permission in the is_visible function, use the
DEVICE_ATTR_RW macro to reduce boiler plate and remove write permission
if the set_temp_limit function is missing.
@vivien
vivien / 001-hash-urls.patch
Created February 18, 2015 16:31
Draft to hash URLs in Glowing Bear plugins
diff --git a/js/plugins.js b/js/plugins.js
index b282d13..839df4c 100644
--- a/js/plugins.js
+++ b/js/plugins.js
@@ -21,6 +21,50 @@ var Plugin = function(name, contentForMessage) {
};
};
+var parseURL = function(url) {
+ var regexp = /(https?):\/\/(?:www\.)?([^\/\?#]+)(\/[^\?#]+)?(#|\?)?(.*)/;
@vivien
vivien / 002-single-url-plugin.patch
Last active August 29, 2015 14:15
Draft for a single URL plugin in Glowing Bear
diff --git a/js/plugins.js b/js/plugins.js
index 839df4c..b5559b8 100644
--- a/js/plugins.js
+++ b/js/plugins.js
@@ -94,6 +94,44 @@ var UrlPlugin = function(name, urlCallback) {
};
};
+var urlHandlers = [{
+ /*
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="/webservices/catalog/xsl/searchRetrieveResponse.xsl"?>
<searchRetrieveResponse xmlns="http://www.loc.gov/zing/srw/" xmlns:oclcterms="http://purl.org/oclc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:diag="http://www.loc.gov/zing/srw/diagnostic/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<version>1.1</version>
<numberOfRecords>801</numberOfRecords>
<records>
<record>
<recordSchema>marcxml</recordSchema>
<recordPacking>xml</recordPacking>
@vivien
vivien / allourl.rb
Created February 10, 2011 03:20
A tiny Ruby API for the AlloURL service.
# A tiny Ruby API for the AlloURL service.
#
# Author: Vivien 'v0n' Didelot <vivien.didelot@gmail.com>
require 'open-uri'
module AlloURL
module_function
# Retrieves the link encapsulated in the AlloURL +url+.