This file contains hidden or 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
type DrawerProps = { fullName: string } & ( | |
| { shape: 'circle'; radius: number } | |
| { shape: 'square'; width: number } | |
| { shape: 'rectangle'; width: number; height: number } | |
); |
This file contains hidden or 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 React, { useEffect, useImperativeHandle, useState, forwardRef, useCallback } from 'react' | |
import { createPortal } from 'react-dom' | |
import './styles.css' | |
const modalElement = document.getElementById('modal-root') | |
export function Modal({ children, fade = false, defaultOpened = false }, ref) { | |
const [isOpen, setIsOpen] = useState(defaultOpened) | |
const close = useCallback(() => setIsOpen(false), []) |
This file contains hidden or 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
package enum_example | |
import ( | |
"bytes" | |
"encoding/json" | |
) | |
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred | |
type TaskState int |
This file contains hidden or 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 | |
############################################################################## | |
# An rclone backup script by Jared Males ([email protected]) | |
# | |
# Copyright (C) 2018 Jared Males <[email protected]> | |
# | |
# This script is licensed under the terms of the MIT license. | |
# https://opensource.org/licenses/MIT | |
# |
This file contains hidden or 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
FILE SPACING: | |
# double space a file | |
sed G | |
# double space a file which already has blank lines in it. Output file | |
# should contain no more than one blank line between lines of text. | |
sed '/^$/d;G' |
This file contains hidden or 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
FROM ubuntu:latest | |
RUN apt -y update && \ | |
apt -y full-upgrade && \ | |
apt -y autoremove && \ | |
apt -y install sudo zsh git curl | |
RUN useradd -U -m john && \ | |
usermod -aG sudo -s /bin/zsh john && \ | |
echo "john ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/john && \ |
This file contains hidden or 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 | |
CHECK_SYMBOL='\u2713' | |
X_SYMBOL='\u2A2F' | |
# | |
# Run the command passed as 1st argument and shows the spinner until this is done | |
# | |
# @param String $1 the command to run | |
# @param String $2 the title to show next the spinner | |
# @param var $3 the variable containing the return code |
This file contains hidden or 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
# List all [sections] of a .INI file | |
sed -n 's/^[ \t]*\[\(.*\)\].*/\1/p' $ini_file | |
# Read KEY from [SECTION] | |
sed -n '/^[ \t]*\[SECTION\]/,/\[/s/^[ \t]*KEY[ \t]*=[ \t]*//p' | |
# Read all values from SECTION in a clean KEY=VALUE form | |
sed -n '/^[ \t]*\[SECTION\]/,/\[/s/^[ \t]*\([^#; \t][^ \t=]*\).*=[ \t]*\(.*\)/\1=\2/p' |
This file contains hidden or 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
chrome.webRequest.onBeforeRequest.addListener(function (request) { | |
const askedURL = new URL(request.url); | |
const keywords = askedURL.searchParams.get("q"); | |
if (/bing.|google.|yahoo./.test(askedURL.hostname)) | |
{ | |
const destinationUrl = (keywords) ? "https://www.framabee.org?q=" + keywords : "https://www.framabee.org"; | |
return { redirectUrl: destinationUrl }; | |
} | |
}, |
NewerOlder