Skip to content

Instantly share code, notes, and snippets.

View matiaskorhonen's full-sized avatar

Matias Korhonen matiaskorhonen

View GitHub Profile
@matiaskorhonen
matiaskorhonen / ics.md
Created November 20, 2019 12:35
Add iCalendar/ICS feed to Google calendar

Link to add a iCalendar feed to Google Calendar

https://www.google.com/calendar/render?cid=http://example.org/index.ics

Note: cid must be a plain HTTP URL even if the feed is actually served over HTTPS

Source: https://stackoverflow.com/a/1479310

@matiaskorhonen
matiaskorhonen / rtl_433.rb
Created August 23, 2019 21:18
Parse streaming output from rtl_433
require "json"
IO.popen("./rtl_433 -F json") do |io|
while (line = io.gets) do
begin
puts JSON.parse(line).inspect
rescue JSON::ParserError
puts line
end
end
@matiaskorhonen
matiaskorhonen / eurukoshots.rb
Created July 8, 2019 07:55
Generate screenshots of all the Euruko sites
#!/usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "down"
gem "pry"
end
@matiaskorhonen
matiaskorhonen / euruko-map.rb
Created July 8, 2019 07:54
Build a map of all the Euruko cities
#!/usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "addressable"
gem "nokogiri"
gem "pry"
end
@matiaskorhonen
matiaskorhonen / gsuite-csv-to-ldif.rb
Created May 8, 2019 11:38
Convert a G Suite CSV to LDIF
require "csv"
csv = CSV.new(File.open("User_Download_08052019_142707.csv"), headers: :first_row)
File.open("./gsuite.ldif", "w+") do |file|
csv.each_with_index do |row, index|
file.write("dn: cn=#{row["First Name [Required]"]} #{row["Last Name [Required]"]},id=#{201 + index}\r\n")
file.write("cn: #{row["First Name [Required]"]} #{row["Last Name [Required]"]}\r\n")
file.write("givenname: -----\r\n")
file.write("mail: #{row["Email Address [Required]"]}\r\n")
body {
transform: skew(20deg);
animation: shake 2s infinite;
animation-direction: alternate;
}
@keyframes shake {
0% {
transform: skewX(20deg);
}
<img src="data:image/svg+xml;charset=utf-8,
<svg xmlns='w3.org/2000/svg'
width='1280' height='720' />"
data-src="lazy.jpg"
alt="A lazy Jpeg" />
@matiaskorhonen
matiaskorhonen / __paths.txt.erb
Last active March 2, 2019 09:11
Read paths from a file and process them with https://github.com/addyosmani/critical/
<% sitemap.resources.select {|r| r.path =~ /\.html\z/i }.each do |resource| %>
<%= resource.destination_path %>
<% end %>
--- array.c~ Thu Dec 21 14:39:19 1995
+++ array.c Thu Dec 21 14:36:06 1995
@@ -283,8 +283,8 @@
end = len + end;
if (end < 0) end = 0;
}
- if (len < end) end = len;
- if (beg < end) {
+ if (end > len) end = len;
+ if (beg > end) {
@matiaskorhonen
matiaskorhonen / recursive-hashes
Last active November 11, 2020 16:39
Generate SHA256 recursively in a directory tree. Uses the same checksum file format as https://linux.die.net/man/1/sha256sum
#!/usr/bin/env ruby
require "digest"
require "find"
require "optparse"
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: recursive-hashes [options]"