When using import React, { useState } from 'react'
in your components, this is how you can mock useState
with jest
.
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
const someObject : { [key: string]: any } = {} |
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 | |
# This script is based on https://unix.stackexchange.com/revisions/480191/9 . | |
# The following changes proved to be necessary to make it work on CentOS 7: | |
# * removed disk info (model, size) - not very useful, might not work in many cases. | |
# * using "bw" instead of "bw_bytes" to support fio version 3.1 (those availible through yum @base) | |
# * escaping exclamation mark in sed command | |
# * the ".fiomark.txt" is not auto-removed | |
LOOPS=5 #How many times to run each test |
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
#!/usr/bin/env bash | |
# ======================================================================================= | |
# | |
# A simple script to test Synology NAS disk speed with hdparm, dd and fio. | |
# | |
# How to use: | |
# | |
# 1. Save synology_disk_benchmark.sh and xfio.conf to your Synology NAS | |
# 2. Make it executable: chmod +x synology_disk_benchmark.sh |
Localstack comes with a docker-compose file that won't quite work when you're running the (linux) container in docker for Windows.
Two changes need to be made:
We can just comment that line out:
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
# Useful references: | |
# | |
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line | |
# https://ss64.com/vb/sendkeys.html | |
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell | |
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/ | |
# | |
# Future enhancements - use events rather than an infinite loop | |
$wsh = New-Object -ComObject WScript.Shell | |
while (1) { |
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
# Author: @yuan3y | |
# Date: 2017-09-29 | |
# Description: to make `jekyll serve` a system service and start on boot | |
# | |
# Usage: place this file at `/etc/systemd/system/jekyll.service` | |
# then run | |
# sudo systemctl start jekyll.service | |
# sudo systemctl enable jekyll.service | |
[Unit] |
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
echo -e " \033[0;30m Preto \033[0m --> 0;30 " | |
echo -e " \033[0;31m Vermelho \033[0m --> 0;31 " | |
echo -e " \033[0;32m Verde \033[0m --> 0;32 " | |
echo -e " \033[0;33m Marrom \033[0m --> 0;33 " | |
echo -e " \033[0;34m Azul \033[0m --> 0;34 " | |
echo -e " \033[0;35m Purple \033[0m --> 0;35 " | |
echo -e " \033[0;36m Cyan \033[0m --> 0;36 " | |
echo -e " \033[0;37m Cinza Claro \033[0m --> 0;37 " | |
echo -e " \033[1;30m Preto Acinzentado \033[0m --> 1;30 " | |
echo -e " \033[1;31m Vermelho Claro \033[0m --> 1;31 " |