Skip to content

Instantly share code, notes, and snippets.

View madbence's full-sized avatar
🙈
watching cat videos on the internet

Bence Dányi madbence

🙈
watching cat videos on the internet
View GitHub Profile
function createMock<T>(mock: Partial<jest.Mocked<T> | T> = {}) {
const props: any = {};
const p: any = new Proxy({}, {
get(_target, prop) {
if (prop in mock) return (mock as any)[prop];
if (prop in props) return props[prop];
if (prop === Symbol.iterator) return undefined;
if (prop === 'then') return undefined;
if (prop === '_isMockFunction') return false;
const fn: any = jest.fn(() => createMock());
@madbence
madbence / Dockerfile
Last active January 25, 2019 14:47
vim on steroids
FROM ubuntu
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y curl \
git \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
location ~ "^/\.well-known/acme-challenge/([-_a-zA-Z0-9]*)$" {
default_type text/plain;
return 200 "$1.$letsencrypt_account_thumbprint";
}
Protocol 2
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
KexAlgorithms curve25519-sha256@libssh.org
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
AllowGroups ssh-user
PasswordAuthentication no
# Download GoogleTest
if(ENABLE_TESTS)
set(GTEST_VERSION 1.7.0)
set(GTEST_NAME gtest-${GTEST_VERSION})
if(NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/external/${GTEST_NAME})
set(GTEST_ARCHIVE ${GTEST_NAME}.zip)
set(GTEST_URL http://googletest.googlecode.com/files/${GTEST_ARCHIVE})
set(GTEST_ARCHIVE_MD5 2d6ec8ccdf5c46b05ba54a9fd1d130d7)
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000
setopt appendhistory autocd histignoredups
unsetopt beep
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/vagrant/.zshrc'
{
"presets": [
["env", {
"targets": {
"browsers": ["Chrome >= 56"]
}
}]
],
"plugins": ["inferno"]
}
const net = require('net');
const exec = require('child_process').exec;
const os = require('os');
function run(cmd) {
return new Promise((resolve, reject) => {
exec(cmd, (err, stdout) => {
if (err) {
return reject(err);
}
// :-(
fn main() {
let n = (0..10)
.flat_map(|a0| (0..10).filter(move |&a1| a0 != a1).map(move |a1| (a0, a1)))
.flat_map(|(a0, a1)| (0..10).filter(move |&a2| a2 != a0 && a2 != a1).map(move |a2| (a0, a1, a2)))
.flat_map(|(a0, a1, a2)| (0..10).filter(move |&a3| a3 != a0 && a3 != a1 && a3 != a2).map(move |a3| (a0, a1, a2, a3)))
.flat_map(|(a0, a1, a2, a3)| (0..10).filter(move |&a4| a4 != a0 && a4 != a1 && a4 != a2 && a4 != a3).map(move |a4| (a0, a1, a2, a3, a4)))
.flat_map(|(a0, a1, a2, a3, a4)| (0..10).filter(move |&a5| a5 != a0 && a5 != a1 && a5 != a2 && a5 != a3 && a5 != a4).map(move |a5| (a0, a1, a2, a3, a4, a5)))
.flat_map(|(a0, a1, a2, a3, a4, a5)| (0..10).filter(move |&a6| a6 != a0 && a6 != a1 && a6 != a2 && a6 != a3 && a6 != a4 && a6 != a5).map(move |a6| (a0, a1, a2, a3, a4, a5, a6)))