Skip to content

Instantly share code, notes, and snippets.

Avatar
🧙‍♂️
sup

Luiz Nickel vaporwavie

🧙‍♂️
sup
View GitHub Profile
@vaporwavie
vaporwavie / adding-windows-into-grub.md
Created Jun 16, 2021
Adding Windows to your Grub loader.
View adding-windows-into-grub.md

Step-by-step

  • su -
  • vim /boot/grub/custom.cfg (should be a new file)
  • Add the following snippet:
#This entry should work for any version of Windows installed for UEFI booting

menuentry "Windows (UEFI)" {
 search --set=root --file /EFI/Microsoft/Boot/bootmgfw.efi
@vaporwavie
vaporwavie / csgostatsscraping.js
Last active May 14, 2021
csgostats.gg scraping that lists your matches based on specific filters.
View csgostatsscraping.js
function getRowText(t,e){return t.querySelector(e).innerText.trim()}let csgo=document.querySelectorAll("#match-list-outer > table > tbody > tr"),csgoMatches=[...csgo].map(t=>({date:getRowText(t,"td:nth-of-type(1)"),map:getRowText(t,"td:nth-of-type(3)"),score:getRowText(t,"td:nth-of-type(4)"),kills:+getRowText(t,"td.col-stats:nth-of-type(7)"),deaths:+getRowText(t,"td.col-stats:nth-of-type(8)"),diff:+getRowText(t,"td.col-stats:nth-of-type(10)"),rating:+getRowText(t,"td:nth-last-child(2)")}));function filterMatches(t="date"){const e=Object.keys(csgoMatches[0]);if(!e.some(e=>e===t))throw Error(`Invalid filter. Try using: ${e.join(", ")}. You could also just run it without a filter.`);return csgoMatches.sort((e,o)=>o[t]-e[t])}
@vaporwavie
vaporwavie / vim_shenanigans.md
Last active Jun 28, 2021
some stuff I often use and forget (lol)
View vim_shenanigans.md

Navigating through files

:bf            # Go to first file.
:bl            # Go to last file
:bn            # Go to next file.
:bp            # Go to previous file.
:bw            # Close file.
View keybase.md

Keybase proof

I hereby claim:

  • I am vaporwavie on github.
  • I am vaporwavie (https://keybase.io/vaporwavie) on keybase.
  • I have a public key ASBkKjO-CzeS1Lif-_oqg6FBCaJP-bwzJd1B-CXGhMosmwo

To claim this, I am signing this object:

@vaporwavie
vaporwavie / prepare-commit-msg
Last active Dec 3, 2020
Git Hook that appends your branch name within the commit message.
View prepare-commit-msg
#!/bin/sh
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *' | sed 's:.*/::')
if [ -n "$BRANCH_NAME" ]; then
echo "$BRANCH_NAME: $(cat $1)" > $1
fi
@vaporwavie
vaporwavie / useReduxSelector.tsx
Last active Jun 16, 2020
Demonstração do useSelector com tipagem de state customizada.
View useReduxSelector.tsx
// store.tsx
import { AppState } from 'types' // local lib
import {
useSelector as useReduxSelector, // mask useSelector first import
TypedUseSelectorHook, // declare use selector generic types
} from 'react-redux'
import { configureStore } from '@reduxjs/toolkit'
import reducer from './reducers'
@vaporwavie
vaporwavie / ready.js
Last active May 6, 2020
Document is literally ready
View ready.js
const DOMisReady = (handler: () => void) => {
if (document.readyState !== "loading") {
handler();
} else {
document.addEventListener("DOMContentLoaded", handler);
}
}
// Usage
@vaporwavie
vaporwavie / undiacritic.ts
Created Nov 26, 2019
A diacritic is a glyph added to a letter or basic glyph. This function undoes it.
View undiacritic.ts
export default (sentence: string) => {
let dict = [
{
base: 'A',
letters: /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g,
},
{ base: 'AA', letters: /[\uA732]/g },
{ base: 'AE', letters: /[\u00C6\u01FC\u01E2]/g },
{ base: 'AO', letters: /[\uA734]/g },
{ base: 'AU', letters: /[\uA736]/g },
@vaporwavie
vaporwavie / keybase.md
Created Nov 8, 2019
my keybase proof of existence =)
View keybase.md

Keybase proof

I hereby claim:

  • I am vaporwavie on github.
  • I am vaporwavie (https://keybase.io/vaporwavie) on keybase.
  • I have a public key ASBD_qmfzUeVBnZNuL3mtAMGrZkArUhSopRBviVkDpcfjAo

To claim this, I am signing this object:

@vaporwavie
vaporwavie / hello_world.py
Created Oct 15, 2019
Hello World Examples
View hello_world.py
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()