Skip to content

Instantly share code, notes, and snippets.

View rodolfobandeira's full-sized avatar

Rodolfo rodolfobandeira

View GitHub Profile
@huytd
huytd / wordle.md
Last active November 1, 2024 05:07
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@dragon788
dragon788 / win10_binary_fission.md
Last active November 1, 2024 21:59
Making the Windows 10 "chubby" install.wim compatible with a FAT32 USB so a UEFI bootable USB can be created from Linux/macOS/ChromeOS

MAGIC aka Making Anything Gruelingly "Impossible" Coherent

Whatever operating system you are using to create the USB, you will need to have a Windows 10 ISO, either from Microsoft or your system manufacturer and have a USB drive 8GB or larger (or one with at least 5GB of free space and using the FAT32 filesystem, but using a fresh and empty one is best).

TL;DR

#macOS/Linux
# First try the `bootiso` program, it has options for splitting the WIM for you!
# https://jsamr.github.io/bootiso/
# You need to already have 7zip aka `p7zip` on macOS and Linux, and `wimlib` macOS via `brew` or `wimtools` on Linux
@reyk
reyk / vmctl start ubuntu -d ubuntu-16.10-server-cloudimg-amd64.raw -n nat -c
Last active July 8, 2021 04:09
OpenBSD vmm and meta-data running ubuntu-16.10-server-cloudimg-amd64.raw
- Get OpenBSD from http://www.openbsd.org/ ;)
- Find an Ubuntu cloud image on https://cloud-images.ubuntu.com/
- Get https://github.com/reyk/meta-data and configure it for cloud-init
- Run the VM ...
Script started on Thu Mar 30 01:53:50 2017
# qemu-img convert ubuntu-16.10-server-cloudimg-amd64.img ubuntu-16.10-server-cloudimg-amd64.raw
# vmctl start ubuntu -d ubuntu-16.10-server-cloudimg-amd64.raw -n nat -c
Connected to /dev/ttyp6 (speed 9600)
Changing serial settings was 0/0 now 3/0
@aNNiMON
aNNiMON / EnexToJson.java
Created August 16, 2016 10:40
Converts Evernote .enex files to json
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.EnumSet;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.json.JSONArray;
@getchenge
getchenge / aes.js
Created May 19, 2016 09:16
node aes cryptor
const crypto = require('crypto');
const cryptor = {
encrypt(cryptkey, iv, cleardata) {
cryptkey = crypto.createHash('sha256').update(cryptkey).digest();
const encipher = crypto.createCipheriv('aes-256-cbc', cryptkey, iv);
let encryptdata = encipher.update(cleardata, 'utf8', 'binary');
encryptdata += encipher.final('binary');
return new Buffer(encryptdata, 'binary').toString('base64');
},
decrypt(cryptkey, iv, encryptdata) {
@darkgeek
darkgeek / openbsd_xorg_on_virtualbox
Created May 14, 2016 13:19
Better Xorg resolution for OpenBSD as a guest on Virtualbox
# Get from https://www.snip2code.com/Snippet/619307/OpenBSD-Virtualbox-guest-xorg-conf , thanks!
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/X11R6/lib/modules"
dog = new Dog()
// ...

// Não importa se é um Cão, Lobo ou Gato, apenas quero saber se vai latir.
// A medida que os requisitos mudarem, pode haver outras
// formas de latir, porém, esse trecho de código continuará operando
// 
// O que se deve levar em consideração é o que o método .bark() retorna,
// uma string ou um objeto/function? deve se pensar na abstração,
public class DistanceRootToNode {
public int Pathlength(Node root, int n1) {
if (root != null) {
int x = 0;
if ((root.data == n1) || (x = Pathlength(root.left, n1)) > 0
|| (x = Pathlength(root.right, n1)) > 0) {
return x + 1;
}
@vasanthk
vasanthk / System Design.md
Last active November 17, 2024 14:09
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@grantspeelman
grantspeelman / Gemfile
Last active December 16, 2020 13:11
Example Gemfile files preparing for the next rails upgrade (https://grant-ps.blog/2017/07/03/upgrading-ruby-on-rails-in-smallish-steps/)
@next_upgrade ||= false
source 'https://rubygems.org'
if @next_upgrade
gem 'rails', '6.0.0.rc2'
else
gem 'rails', '~> 5.2.0'
end
# rest of gems below ....