Skip to content

Instantly share code, notes, and snippets.

View Fawers's full-sized avatar
💻
Studying and gaming

Fabricio Werneck Fawers

💻
Studying and gaming
View GitHub Profile
@Fawers
Fawers / description.md
Created November 25, 2023 17:52
n buckets problem solutions

There are N buckets arranged in a row. Each bucket either is empty or contains a ball. The buckets are specified as a string buckets consisting of characters "." (empty bucket) and " B " (bucket with aball). For example, for buckets = "B. BB. B. . B" the row of buckets appears as follows: In one move you can take the ball out of any bucket and place it in another (empty) bucket. Your goal is to arrange the balls to create an alternating sequence of full and empty buckets. In other words, the distance between two consecutive balls should be equal to 2. Note that the sequence may start at any bucket. For example, in the figure below, the balls are placed correctly: On the other hand, in both of the figures below, the balls are placed incorrectly: What is the minimum number of moves required to create a correct sequence of balls in buckets

@Fawers
Fawers / attempt0.scala
Last active July 22, 2022 21:28
timers and schedulers
import java.util.Date
import akka.actor._
import scala.concurrent.duration._
class TimedActor extends Actor with ActorLogging {
override def receive: Receive = onTimer(None, None)
def onTimer(msgReceived: Option[Date], oldTimer: Option[Cancellable]): Receive = {
case msg =>
oldTimer foreach (_.cancel())
@Fawers
Fawers / untar_into.sh
Created December 13, 2021 18:21
Untar ARCHIVE into DIR
function untar_into() {
[[ -z "$1" ]] && echo "No tar file specified" && return
[[ -z "$2" ]] && echo "No destination specified" && return
[[ ! -e "$1" ]] && echo "Specified tar file absent: $1" && return
[[ -e "$2" ]] && echo "Destination dir already exists: $2" && return
local archive=$1
local target=$2
mkdir -pv $target
mv $archive $target
@Fawers
Fawers / world-of-trouble.md
Last active June 8, 2019 21:35
Vian Izak - World of Trouble

Vian Izak - World of Trouble

Capo 7 (may be different to you; I use a customized tuning)

Intro
G C Em D
G C Em D

I'm not afraGid that we falCtered before
Every faEmll we endured made us wantD it all more

@Fawers
Fawers / keybindings.json
Last active April 24, 2019 12:26
VSCode Settings + Keybindings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "alt+j",
"command": "editor.action.triggerSuggest",
"when": "editorHasCompletionItemProvider && editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+space",
"command": "-editor.action.triggerSuggest",
@Fawers
Fawers / main.go
Created April 11, 2019 23:04
async - go and python
// https://repl.it/@fswerneck/goroutines
package main
import "fmt"
func consume(q <-chan interface{}, finish chan<- bool) {
fmt.Println("getting from q")
mydata := <-q
fmt.Printf("got %v from q\n", mydata)

Advérbios vs. Adjetivos

Regra de linguística geral:

  • Advérbios modificam tudo, até mesmo outros advérbios, com exceção de substantivos
  • Apenas adjetivos modificam substantivos, e modificam apenas substantivos

Isso se aplica em qualquer idioma.

A maioria dos advérbios são, por si só, criados a partir de adjetivos.

@Fawers
Fawers / wkreorder.js
Last active June 6, 2018 02:57
WaniKani Reorder
/**
* 2018-04-25
* WaniKani Reorder - wkreorder
* Reorder your review items on the fly
* (Optimized for phones)
*
* With wk-reorder, you're able to - tada - reorder your review items by some criteria.
* As of this script, you're able to reorder them by SRS level, and type.
* The script works by getting your current queue, and applying a sort function to make it
* show items in the order you want them to - either ascendingly or descendingly.
@Fawers
Fawers / wkrollback.js
Last active April 1, 2018 23:39
WaniKani Rollback Answer
/**
* wkrollback - WaniKani Rollback Answer
* Inspired by Wanikani Override userscript on Greasy Fork,
* but aimed at mobiles, as an inline JavaScript bookmarklet.
* This is the unminified code; use the minified version on
* your browser.
*
* Author: Fabricio da Silva Werneck
* Date: 2018-04-01 19:24 -0300
*
@Fawers
Fawers / verbs.md
Last active December 25, 2017 05:22
Japanese verbs and their patterns

PSA: Verb conjugation becomes fairly easy when you get to understand the pattern.

Disclaimer: I may or may not have made some mistakes below. Do feel free to point them out so I can edit the post.


(irregular verbs not included)

  • Ichidan verbs
  • Always end in る