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 / 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 / overlay.css
Created January 2, 2019 00:32
Overlay
.overlay{
position: relative;
}
.overlay > *{
position: relative;
z-index: 1;
}
.overlay:before{
@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 / csv2json.py
Last active December 25, 2015 09:49
From csv to json in one twitt
import csv, json
f = open('sample.csv', 'r')
reader = csv.DictReader(f, fieldnames=("col1","col2"))
print json.dumps(list(reader))
def max_sum(vector):
return cubic_solution(vector)
def cubic_solution(vector):
max_sum = 0
for i in range(len(vector) + 1):
for j in range(i):
partial_sum = sum(vector[j:i])
max_sum = max(partial_sum, max_sum)
return max_sum
@israelst
israelst / merge-without-slice.py
Created May 5, 2012 11:21
Merging two ordered lists
def merge(x, y):
if len(x) == 0:
return y
if len(y) == 0:
return x
last = y.pop() if x[-1] < y[-1] else x.pop()
# 'merged' is required because the append method is in place
merged = merge(x, y)
merged.append(last)
#!/bin/bash
p(){
cd $(find ~/Projects/ -name $1)
}