View keybindings.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
mkdir -p ~/Library/KeyBindings | |
cat > ~/Library/KeyBindings/DefaultKeyBinding.dict << EOF | |
{ | |
/* Remap Home / End keys to be correct */ | |
"\UF729" = "moveToBeginningOfLine:"; /* Home */ | |
"\UF72B" = "moveToEndOfLine:"; /* End */ | |
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */ | |
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */ |
View rex.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from collections import deque | |
from functools import reduce | |
def rex(pattern): | |
tokens = deque(pattern) | |
def walk(chars): | |
while tokens and tokens[0] in chars: | |
yield tokens.popleft() |
View regression.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Crescimento por dia: 36.84% | |
2020-02-26 0 1 | |
2020-02-27 0 1 | |
2020-02-28 1 1 | |
2020-02-29 1 2 | |
2020-03-01 2 2 | |
2020-03-02 2 2 | |
2020-03-03 3 2 | |
2020-03-04 5 4 | |
2020-03-05 7 4 |
View regression.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime, numpy as np | |
first_day = datetime.date(2020, 2, 26) | |
y = np.array([1, 1, 1, 2, 2, 2, 2, 4, 4, 13, 13, 20, 25, 31, 38, 52, 151, 151, 162, 200, 321, 372, 621, 793]) | |
x = np.arange(1, len(y)+1) | |
curve = np.exp(np.polyfit(x, np.log(y), 1)) | |
#y = b*a^x | |
#log(y) = xlog(a)+log(b) |
View performance.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var performanceReport = function(perf) { | |
if (perf == null) | |
return console.log("No storage query was run yet!"); | |
var perc = n => isNaN(n) ? 0 : Math.round(n*1000.0)/10; | |
var expectedEvents = 0, actualEvents = 0, cacheReads=0, cacheWrites=0, metrics = {}; | |
var count = {'init': 0, 'read': 0, 'flow': 0, 'misc': 0, 'filter': 0 }; | |
var time = {'init': 0, 'read': 0, 'flow': 0, 'misc': 0, 'filter': 0 }; | |
View settings.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.intelie.live.* | |
import net.intelie.live.util.* | |
import net.intelie.live.queries.* | |
import net.intelie.live.model.* | |
import javax.ws.rs.* | |
import javax.ws.rs.core.* | |
import javax.servlet.http.* | |
import org.springframework.security.web.csrf.* | |
import org.springframework.web.util.* | |
import com.google.gson.* |
View tzdata.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On Ubuntu: make sure you have lzip and gawk installed | |
tmp_dir=$(mktemp -d -t tzdata-XXXXXXXXXX) | |
cd $tmp_dir | |
wget https://cdn.azul.com/tools/ziupdater1.0.2.2-jse8+7-any_jvm.tar.gz | |
wget https://data.iana.org/time-zones/releases/tzdb-2019c.tar.lz | |
tar zfxv ziupdater*.tar.gz | |
tar lfxv tzdb-2019c.tar.lz | |
cd tzdb-2019c/ |
View TestSizeUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.intelie.introspective.ObjectSizer; | |
import java.lang.ref.WeakReference; | |
import java.util.*; | |
import java.util.concurrent.atomic.AtomicLong; | |
public class TestSizeUtils { | |
public static String formatBytes(double value) { | |
String[] NAMES = {"B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}; | |
int name = 0; |
View A.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
int T[200]; | |
int main() { | |
ios_base::sync_with_stdio(false); | |
int test; cin >> test; | |
int N; |
View gist:93e687e65dca1eeb44640c122dbdcb0d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
var get = async(url, prop, dataless) => { | |
var data = (await (await fetch(url)).json()); | |
if (!dataless) data = data.data; | |
| |
var result = {}; | |
data.forEach(element => { | |
result[element[prop]] = element; | |
}); | |
return result; |
NewerOlder