Skip to content

Instantly share code, notes, and snippets.

@israelst
israelst / setup_manjaro.md
Created August 1, 2023 14:48
Setup Manjaro with dual boot and SSD Encryption

Pre-install

First, I resized the Windows partition using the native Windows disk partition tool. Then, I've disabled the secure boot, so I can boot using the USB drive.

First attempt

This happened probably because the /boot folder was encrypted, and the passphrase happens before grub loads. At this point, the additional keyboard layout is not set up, so I probably typed the wrong password.

After a few seconds (as the grub decryption is slower than the root decryption), I received the following error and was left in the grub rescue state. This behavior is described here.

Workaround

As I'm using dual boot in the same storage device, I naively installed Manjaro entirely within a single encrypted partition by choosing the "Replace partition" option during the partition installation step.

@israelst
israelst / plot.awk
Created July 28, 2020 19:07 — forked from katef/plot.awk
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@israelst
israelst / getAllColors.js
Last active March 19, 2019 12:00
Get all colors used in a webpage.
const els = document.querySelectorAll('*');
const isColorProperty = property => property.toLowerCase().indexOf('color') > -1;
colors = new Set();
for(el of els)
for(property in getComputedStyle(el))
if(isColorProperty(property))
colors.add(getComputedStyle(el)[property])
console.dir(colors.entries())
@israelst
israelst / overlay.css
Created January 2, 2019 00:32
Overlay
.overlay{
position: relative;
}
.overlay > *{
position: relative;
z-index: 1;
}
.overlay:before{
@israelst
israelst / chunk_indexes.py
Last active February 3, 2019 17:02
Helper functions to data structures hacking
def chunk_indexes(size, chunk_size):
start = (size % chunk_size) or chunk_size
upper_boundary = list(range(start, size + 1, chunk_size))
lower_boundary = [0] + upper_boundary[:-1]
return zip(lower_boundary, upper_boundary)
@israelst
israelst / GNIP_Historical_parse.py
Created May 25, 2016 18:04
GNIP Historical PowerTrack parse
# coding: utf-8
import json
fd = open('all.json')
lines = fd.readlines()
tweets = map(json.loads, lines)
ptBR_tweets = filter(lambda l: l['language']=='pt', tweets)
@israelst
israelst / keys_from_dicts.py
Created October 1, 2015 21:02
Return a list of unique keys from a list of dicts.
def keys_from_dicts(dicts):
all_keys = sum(map(dict.keys, dicts), [])
return list(set(all_keys))
@israelst
israelst / mini-gitflow-example.sh
Last active August 29, 2015 14:20
This is a example to show a reduced version of gitflow. We are considering two remotes at local repository, the origin (fork) and the upstream (central):
(master) $ # starting a new task
(master) $ git pull --ff-only upstream master
(master) $ git checkout -b feature/new-task
(feature/new-task) $ # some coding
(feature/new-task) $ git add -p
(feature/new-task) $ git commit -m "The answer of all questions of the universe"
(feature/new-task) $ git push origin feature/new-task
(feature/new-task) $ # Do a pull request from feature/new-task to master and wait for coworker acceptance
(feature/new-task) $ git checkout master
(master) $ git pull --ff-only upstream master
@israelst
israelst / preprocess.js
Last active August 29, 2015 14:20
Function that turns Facebook insights into a flat structure.
function preprocess(post){
var flatPost = post.insights.data.reduce(function(post, insight){
post[insight.name] = insight.values[0].value;
return post;
}, {});
flatPost.likes = post.likes.summary.total_count;
flatPost.comments = post.comments.summary.total_count;
flatPost.shares = (post.shares || {'count': 0}).count;
@israelst
israelst / insights.html
Last active August 29, 2015 14:20
Show facebook post data with d3.parcoords
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Curto Café Facebook Page</title>
<script src="preprocess.js" charset="utf-8"></script>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="http://syntagmatic.github.io/parallel-coordinates/d3.parcoords.js" charset="utf-8"></script>
<link href="http://syntagmatic.github.io/parallel-coordinates/d3.parcoords.css" rel="stylesheet" />
</head>