Skip to content

Instantly share code, notes, and snippets.

View vinicius73's full-sized avatar
🤓
"Those who cannot acknowledge themselves, will eventually fail."

Vinicius Reis vinicius73

🤓
"Those who cannot acknowledge themselves, will eventually fail."
View GitHub Profile
@vchernetskyi993
vchernetskyi993 / Cargo.toml
Last active October 3, 2024 11:38
Rust - Single testcontainer for multiple test functions
[package]
name = "testcontainers-sample"
version = "0.1.0"
edition = "2021"
[dev-dependencies]
async_once = "0.2.6"
aws-sdk-s3 = "0.28.0"
ctor = "0.2.4"
lazy_static = "1.4.0"
@vinicius73
vinicius73 / index.js
Created December 1, 2019 16:54
Script de sorteio inimigo/amigo oculto
const { shuffle, map } = require('lodash')
const { sendMessages } = require('./send-email')
const input = shuffle(require('./input.json'))
function assign (array) {
return map(array, (person, index, array) => {
const friend = array[index + 1] || array[0]
return {
person,
@lbssousa
lbssousa / MyComponentJsDoc.vue
Last active July 13, 2022 11:32
A little cheatsheet of how to write type-safe Vue single file components, using either TypeScript or JSDoc comments (reference: https://blog.usejournal.com/type-vue-without-typescript-b2b49210f0b)
<template>
<div>
<slot/>
</div>
</template>
<script>
// @ts-check
/**
@xialvjun
xialvjun / setIn.js
Last active February 23, 2021 18:23
immutable version of lodash/set
// https://github.com/lodash/lodash/issues/1696
import {clone, setWith, curry} from 'lodash/fp';
// export const setIn = curry((path, value, obj) =>
// setWith(clone, path, value, clone(obj)),
// );
export const setIn = curry((obj, path, value) =>
setWith(clone, path, value, clone(obj)),
);
@cyan198
cyan198 / Readme.MD
Last active November 3, 2022 12:14
Setup WiFi with snap on Ubuntu Core

Connect to WiFi on Ubuntu Core using Snap

It was done on the following environment:

  • Raspberry Pi 3 Model B
  • OS: Ubuntu Core
  • Pi is connected to internet via Ethernet

Here are the overview of the steps:

@lubien
lubien / A-umbrella.md
Last active September 7, 2023 17:45
Umbrella Challenge

Umbrella Challenge

Given a number of people N and an array of integers, each one representing the amount of people a type of umbrella can handle, output the minimum number of umbrellas needed to handle N people.

No umbrella could have left spaces. Which means if a umbrella can handle 2 people, there should be 2 people under it.

If there's no solution, return -1.

Examples

const reduce = (reducer, initial, [head, ...tail]) =>
head // condition to go or stop
? reduce(reducer, reducer(initial, head), tail) // recursion
: initial // stop
const map = (mapper, [head, ...tail]) =>
head // condition to go or stop
? [ mapper(head), ...map(mapper, tail) ] //recursion
: [] // stop
private void doSwitchToAP() {
final WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
final WifiApControl wifiApControl = WifiApControl.getInstance(this);
if (wifiApControl.isEnabled()) {
WifiConfiguration config = wifiApControl.getConfiguration();
if (config.SSID.equals(HOTSPOT_SSID) && config.preSharedKey.equals(HOTSPOT_PWD)) {
Utilities.longToast("Already configured as hotspot!");
}
}
final WifiConfiguration apConfig = new WifiConfiguration();
str.split(',')
.map(section => section.split(';'))
.map(([page, rel]) => [
Number(rxPage.exec(page)[1]),
rxRel.exec(rel)[1]
]).reduce((acc, [ page, rel ]) => (
{...acc, [rel]: page}), {}
)
@wilcorrea
wilcorrea / $_GET.js
Last active November 4, 2016 19:16
<script>
function $_GET(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
const regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
const results = regex.exec(url);
if (!results) {
return null;