Skip to content

Instantly share code, notes, and snippets.

@sirodoht
sirodoht / tolltip.css
Last active January 4, 2018 15:42
CSS only simple tooltip from https://codepen.io/cbracco/pen/qzukg
/**
* Demo styles
* Not needed for tooltips to work
*/
/* `border-box`... ALL THE THINGS! */
html {
box-sizing: border-box;
}
@sirodoht
sirodoht / bounce-up.css
Created December 19, 2017 17:38
Simple bounce up CSS animation
.bounce-up {
animation: bounce-up 3s infinite;
}
@keyframes bounce-up {
0%, 20%, 50%, 80%, 100% {
transform: translateY(0);
}
40% {
transform: translateY(-10px);
@sirodoht
sirodoht / index.html
Last active May 13, 2020 18:16
Basic HTML/CSS boilerplate with Normalize.css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
@sirodoht
sirodoht / longest_collatz_sequence.rs
Created January 31, 2018 09:30
Longest Collatz sequence solution, Project Euler #14
// Longest Collatz sequence
// https://projecteuler.net/problem=14
fn collatz(num: u32) -> u32 {
if num == 1 {
return num;
}
if num % 2 == 0 {
num / 2
$ gpg --list-secret-keys
$ gpg --edit-key XXX
gpg> expire
gpg> key 1
gpg> expire
gpg> save
$ gpg --list-secret-keys
@sirodoht
sirodoht / restore-django-postgres-dokku.md
Last active September 15, 2018 06:29
How to restore Django Postgres on dokku (using dokku-postgres plugin backup)

First download the backup from S3. Should be in the form:

postgres-appname-2018-09-14-07-00-04.tgz

Then, delete your local db (or rename it).

Re-create (empty) db (guide).

Then extract, and cd into backup folder. There, the pg dump called export should reside. Execute:

@sirodoht
sirodoht / postgres-dump-restore.md
Last active August 30, 2019 22:43
How to dump and restore in Postgres using custom format

How to dump and restore in Postgres

Dump

$ pg_dump -h localhost -p 5432 -U dbuser -F c -b -v -f "./dump" dbname

Restore

@sirodoht
sirodoht / slugify
Last active November 14, 2018 23:44
Slugify CLI tool in Python
#!/usr/bin/env python3
# Usage:
# slugify any thing here really
# Stolen from Django:
# https://github.com/django/django/blob/277017aea4cf72a1797102e6d129165181d04e17/django/utils/text.py#L386
import re
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
html {
line-height: 1.15;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}

How to generate a self-signed SSL using openssl

$ openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365

-nodes is for not requiring a passphrase (for the key).

How to remove passphrase from key using openssl