This file contains 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
# Ignore everything | |
* | |
# But not these files... | |
!.gitignore | |
!init.el | |
!LICENSE | |
This file contains 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
for file in $(ls | egrep '^.+-[0-9].eml$'); do | |
mv -- "$file" "`echo $file | sed "s/-[0-9].eml$/.eml/"`"; | |
done; |
This file contains 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
autosave = "!f () { \ | |
origin=$(git remote) ; \ | |
project_name=$(git remote get-url $origin | xargs basename -s .git) ; \ | |
current_branch=$(git rev-parse --abbrev-ref HEAD) ; \ | |
gsm=$(git status) ; \ | |
ntc=$(echo $gsm | grep \"nothing to commit, working tree clean\" | wc -l) ; \ | |
ybi=$(echo $gsm | grep \"Your branch is ahead of '$origin/$current_branch' by\" | wc -l) ; \ | |
ybi2=$(echo $gsm | grep \"Your branch is ahead of '$origin/main' by\" | wc -l) ; \ | |
if [ $ntc -ne 1 ] || ([ $ybi -ne 1 ] && [ $ybi2 -ne 0 ]); then\ | |
echo \"💾 Autosaving...\" ; \ |
This file contains 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 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 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 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 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 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 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 |
NewerOlder