This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use base64::{engine::general_purpose, Engine as _}; | |
use chrono::Utc; | |
use http::HeaderMap; | |
use openssl::hash::MessageDigest; | |
use openssl::pkey::{PKey, Private}; | |
use openssl::sha::Sha256; | |
use openssl::sign::Signer; | |
use std::collections::HashMap; | |
use std::fs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'http' | |
require 'openssl' | |
document = File.read('create-hello-world.json') | |
date = Time.now.utc.httpdate | |
sha256 = OpenSSL::Digest::SHA256.new | |
digest = sha256.digest(document) | |
ed = 'SHA-256='+Base64.encode64(digest).strip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Disable how using the scrollwheel on the switches to the next Desktop | |
Source: https://help.ubuntu.com/community/Lubuntu/Mouse#Disable_how_using_the_scrollwheel_on_the_switches_to_the_next_Desktop | |
Before restarting openbox with this command: openbox --reconfigure | |
Edit ~/.config/openbox/lubuntu-rc.xml and remove these lines: | |
<mousebind button="Up" action="Click"> | |
<action name="GoToDesktop"> | |
<to>previous</to> | |
</action> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule DurationFormatter do | |
def format_duration(0), do: "now" | |
def format_duration(s) do | |
year = div(s, 31536000) | |
day = div(s - year * 31536000, 86400) | |
hour = div(s - year * 31536000 - day * 86400,3600) | |
min = div(s - year * 31536000 - day * 86400 - hour * 3600,60) | |
sec = rem(s,60) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Wallpaper do | |
@spec wallpaper(number, number, number) :: String.t | |
def wallpaper(l, w, h) do | |
case (( ( l * h ) + (w * h) )* 2 * 1.15 ) / 5.2 |> Float.ceil do | |
0.0 -> "zero" | |
1.0 -> "one" | |
2.0 -> "two" | |
3.0 -> "three" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Datemizer do | |
def shorten_to_date(datetime) do | |
datetime |> String.split(",") |> hd | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import sys | |
from operator import itemgetter | |
from collections import defaultdict | |
def main(): | |
count = defaultdict(int) | |
for line in sys.stdin: | |
for word in line.split(): | |
count[word] += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env julia | |
count = Dict() | |
for line in eachline(stdin) | |
for word in split(line) | |
if haskey(count,word) | |
count[word] += 1 | |
else | |
count[word] = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install | |
cdrom | |
#repo --name=base --baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/28/Everything/x86_64/os/ | |
#url --url="http://download.fedoraproject.org/pub/fedora/linux/releases/28/Everything/x86_64/os/" | |
lang en_US.UTF-8 | |
keyboard us-colemak | |
timezone --utc UTC | |
authselect --useshadow --enablemd5 | |
selinux --disabled | |
firewall --disabled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install | |
cdrom | |
lang en_US.UTF-8 | |
keyboard us | |
network --device eth0 --onboot yes --bootproto dhcp | |
# To generate password use: openssl passwd -1 -salt abc yourpass | |
rootpw --iscrypted \$1\$abc\$eXT.vKU2cv.5/y/x/JA1H/ | |
firewall --disabled |