Skip to content

Instantly share code, notes, and snippets.

Matias Korhonen matiaskorhonen

Block or report user

Report or block matiaskorhonen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@matiaskorhonen
matiaskorhonen / rtl_433.rb
Created Aug 23, 2019
Parse streaming output from rtl_433
View rtl_433.rb
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 Jul 8, 2019
Generate screenshots of all the Euruko sites
View eurukoshots.rb
#!/usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "down"
gem "pry"
end
@matiaskorhonen
matiaskorhonen / euruko-map.rb
Created Jul 8, 2019
Build a map of all the Euruko cities
View euruko-map.rb
#!/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
Convert a G Suite CSV to LDIF
View gsuite-csv-to-ldif.rb
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")
View skew.css
body {
transform: skew(20deg);
animation: shake 2s infinite;
animation-direction: alternate;
}
@keyframes shake {
0% {
transform: skewX(20deg);
}
View placeholder.html
<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" />
View __paths.txt.erb
<% sitemap.resources.select {|r| r.path =~ /\.html\z/i }.each do |resource| %>
<%= resource.destination_path %>
<% end %>
View array.patch
--- 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 Jan 23, 2019
Generate SHA256 recursively in a directory tree. Uses the same checksum file format as https://linux.die.net/man/1/sha256sum
View recursive-hashes
#!/usr/bin/env ruby
require "digest"
require "find"
require "optparse"
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: recursive-hashes [options]"
@matiaskorhonen
matiaskorhonen / maintenance.html
Created Jan 16, 2019
Basic maintenance page (based on Heroku's)
View maintenance.html
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport"> <title>Offline for maintenance</title> <style>html, body {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
background-color: #F7F8FB;
height: 100%;
-webkit-font-smoothing: antialiased; }
body {
You can’t perform that action at this time.