1608660960
The reactjs-crontab module is very light-weight task scheduler in reactjs based on linux crontab. This module allows you to schedule task in reactjs.
Crontab Syntax Guide at https://d180vcwahe2y6s.cloudfront.net/build/index.html
npm install --save reactjs-crontab
This is useful when you need to render component at particular time
import React from 'react'
import Crontab from 'reactjs-crontab'
import 'reactjs-crontab/dist/index.css'
const styles = {
text: {
margin: '70px',
color: 'skyblue'
}
}
const MorningMsg = () => {
return <h1 style={styles.text}>Good Morning !</h1>
}
const App = () => {
const [open, setOpen] = React.useState(null)
const sayGoodMorning = () => {
setOpen(true)
}
// this is the function which will run according to your settings
const tasks = [
{
fn: sayGoodMorning,
id: '1',
config: '*-*-*-*-*',
// this runs every minutes
name: '',
description: ''
}
]
return (
<div>
<Crontab
tasks={tasks}
timeZone='local'
// timezone is PC local timezone.
dashboard={{
hidden: false
// if true, dashboard is hidden
}}
/>
{open && <MorningMsg />}
</div>
)
}
export default App
Copying and pasting above code will render ‘’ if it’s 08:00 like the screenshot below
This is useful when you need to implement some function like api call at particular time.
import React from 'react'
import Crontab from 'reactjs-crontab'
import 'reactjs-crontab/dist/index.css'
const sayHello = () => {
console.log('Hello')
}
const RequestSomething = () => {
console.log('Api request has been sent')
}
// these are the functions which will run according to the config
const tasks = [
{
fn: sayHello,
id: '1',
config: '*-*-*-*-*',
// Execute every minutes
name: 'Say Hello',
description: 'Say Hello on console'
},
{
fn: RequestSomething,
id: '3',
config: '*-15,19-*-11,12-*',
// Execute In November, December At 3PM and 7PM every minute
name: 'Request Something',
description: 'Send API'
}
]
const App = () => {
return (
<Crontab
tasks={tasks}
timeZone='UTC'
// timezone is UTC timezone.
dashboard={{
hidden: false
// if true, dashboard is hidden
}}
/>
)
}
export default App
Copying and pasting above code will result something like this below
This will do what it says at the requested time(s).
# ┌──────────── minute
# │ ┌────────── hour
# │ │ ┌──────── day of month
# │ │ │ ┌────── month
# │ │ │ │ ┌──── day of week
# │ │ │ │ │
# *-*-*-*-*
MIN-HOUR-DOM-MON-DOW
OR
Can be multiple values like this
# ┌──────────── minute
# │ ┌────────── hour
# │ │ ┌──────── day of month
# │ │ │ ┌────── month
# │ │ │ │ ┌──── day of week
# │ │ │ │ │
# 1,2-6,7-*-*-*
MIN,MIN-HOUR,HOUR-DOM,DOM-MON,MON-DOW,DOW
field | value |
---|---|
minute | 0-59 |
hour | 0-23 |
day of month | 1-31 |
month | 1-12 |
day of week | 1-7 (7 is sunday) |
Crontab Props {
tasks: [
{
fn: yourFn,
id: '1',
config: '*-11-18-10,13-*',
name: 'logUserOut',
description: 'Send API'
}
],
timeZone: "UTC", "local" or "YOUR PREFERRED TIMEZONE",
// supported timezone list here
// https://github.com/shawnscoding/reactjs-crontab/blob/master/TIMEZONES.md
dashboard: {
hidden: false
// if true, dashboard is hidden
}
}
Crontab.propTypes = {
tasks: PropTypes.arrayOf(
PropTypes.shape({
fn: PropTypes.func.isRequired,
id: PropTypes.string.isRequired,
config: PropTypes.string.isRequired,
name: PropTypes.string,
description: PropTypes.string
})
),
dashboard: PropTypes.shape({
hidden: PropTypes.bool.isRequired
}),
timeZone: PropTypes.string.isRequired
}
Crontab.defaultProps = {
tasks: [],
dashboard: {
hidden: false
},
timeZone: 'UTC'
}
<BasicCron />
is deprecated. use default import as <Crontab />
to use crontabWe use browserslist config to state the browser support for this lib, so check it out on browserslist.dev.
supported timezone list here
Author: shawnscoding
Demo: https://d180vcwahe2y6s.cloudfront.net/index.html
Source Code: https://github.com/shawnscoding/reactjs-crontab
#react #reactjs #javascript
1608660960
The reactjs-crontab module is very light-weight task scheduler in reactjs based on linux crontab. This module allows you to schedule task in reactjs.
Crontab Syntax Guide at https://d180vcwahe2y6s.cloudfront.net/build/index.html
npm install --save reactjs-crontab
This is useful when you need to render component at particular time
import React from 'react'
import Crontab from 'reactjs-crontab'
import 'reactjs-crontab/dist/index.css'
const styles = {
text: {
margin: '70px',
color: 'skyblue'
}
}
const MorningMsg = () => {
return <h1 style={styles.text}>Good Morning !</h1>
}
const App = () => {
const [open, setOpen] = React.useState(null)
const sayGoodMorning = () => {
setOpen(true)
}
// this is the function which will run according to your settings
const tasks = [
{
fn: sayGoodMorning,
id: '1',
config: '*-*-*-*-*',
// this runs every minutes
name: '',
description: ''
}
]
return (
<div>
<Crontab
tasks={tasks}
timeZone='local'
// timezone is PC local timezone.
dashboard={{
hidden: false
// if true, dashboard is hidden
}}
/>
{open && <MorningMsg />}
</div>
)
}
export default App
Copying and pasting above code will render ‘’ if it’s 08:00 like the screenshot below
This is useful when you need to implement some function like api call at particular time.
import React from 'react'
import Crontab from 'reactjs-crontab'
import 'reactjs-crontab/dist/index.css'
const sayHello = () => {
console.log('Hello')
}
const RequestSomething = () => {
console.log('Api request has been sent')
}
// these are the functions which will run according to the config
const tasks = [
{
fn: sayHello,
id: '1',
config: '*-*-*-*-*',
// Execute every minutes
name: 'Say Hello',
description: 'Say Hello on console'
},
{
fn: RequestSomething,
id: '3',
config: '*-15,19-*-11,12-*',
// Execute In November, December At 3PM and 7PM every minute
name: 'Request Something',
description: 'Send API'
}
]
const App = () => {
return (
<Crontab
tasks={tasks}
timeZone='UTC'
// timezone is UTC timezone.
dashboard={{
hidden: false
// if true, dashboard is hidden
}}
/>
)
}
export default App
Copying and pasting above code will result something like this below
This will do what it says at the requested time(s).
# ┌──────────── minute
# │ ┌────────── hour
# │ │ ┌──────── day of month
# │ │ │ ┌────── month
# │ │ │ │ ┌──── day of week
# │ │ │ │ │
# *-*-*-*-*
MIN-HOUR-DOM-MON-DOW
OR
Can be multiple values like this
# ┌──────────── minute
# │ ┌────────── hour
# │ │ ┌──────── day of month
# │ │ │ ┌────── month
# │ │ │ │ ┌──── day of week
# │ │ │ │ │
# 1,2-6,7-*-*-*
MIN,MIN-HOUR,HOUR-DOM,DOM-MON,MON-DOW,DOW
field | value |
---|---|
minute | 0-59 |
hour | 0-23 |
day of month | 1-31 |
month | 1-12 |
day of week | 1-7 (7 is sunday) |
Crontab Props {
tasks: [
{
fn: yourFn,
id: '1',
config: '*-11-18-10,13-*',
name: 'logUserOut',
description: 'Send API'
}
],
timeZone: "UTC", "local" or "YOUR PREFERRED TIMEZONE",
// supported timezone list here
// https://github.com/shawnscoding/reactjs-crontab/blob/master/TIMEZONES.md
dashboard: {
hidden: false
// if true, dashboard is hidden
}
}
Crontab.propTypes = {
tasks: PropTypes.arrayOf(
PropTypes.shape({
fn: PropTypes.func.isRequired,
id: PropTypes.string.isRequired,
config: PropTypes.string.isRequired,
name: PropTypes.string,
description: PropTypes.string
})
),
dashboard: PropTypes.shape({
hidden: PropTypes.bool.isRequired
}),
timeZone: PropTypes.string.isRequired
}
Crontab.defaultProps = {
tasks: [],
dashboard: {
hidden: false
},
timeZone: 'UTC'
}
<BasicCron />
is deprecated. use default import as <Crontab />
to use crontabWe use browserslist config to state the browser support for this lib, so check it out on browserslist.dev.
supported timezone list here
Author: shawnscoding
Demo: https://d180vcwahe2y6s.cloudfront.net/index.html
Source Code: https://github.com/shawnscoding/reactjs-crontab
#react #reactjs #javascript
1650391200
The Ansible Jupyter Kernel adds a kernel backend for Jupyter to interface directly with Ansible and construct plays and tasks and execute them on the fly.
ansible-kernel
is available to be installed from pypi but you can also install it locally. The setup package itself will register the kernel with Jupyter
automatically.
pip install ansible-kernel
python -m ansible_kernel.install
pip install -e .
python -m ansible_kernel.install
pip install ansible-kernel
python -m ansible_kernel.install --sys-prefix
jupyter notebook
# In the notebook interface, select Ansible from the 'New' menu
docker run -p 8888:8888 benthomasson/ansible-jupyter-kernel
Then copy the URL from the output into your browser:
http://localhost:8888/?token=ABCD1234
Normally Ansible
brings together various components in different files and locations to launch a playbook and performs automation tasks. For this jupyter
interface you need to provide this information in cells by denoting what the cell contains and then finally writing your tasks that will make use of them. There are Examples available to help you, in this section we'll go over the currently supported cell types.
In order to denote what the cell contains you should prefix it with a pound/hash symbol (#) and the type as listed here as the first line as shown in the examples below.
The inventory that your tasks will use
#inventory
[all]
ahost ansible_connection=local
anotherhost examplevar=val
This represents the opening block of a typical Ansible
play
#play
name: Hello World
hosts: all
gather_facts: false
This is the default cell type if no type is given for the first line
#task
debug:
#task
shell: cat /tmp/afile
register: output
This takes an argument that represents the hostname. Variables defined in this file will be available in the tasks for that host.
#host_vars Host1
hostname: host1
This takes an argument that represents the group name. Variables defined in this file will be available in the tasks for hosts in that group.
#group_vars BranchOfficeX
gateway: 192.168.1.254
This takes an argument that represents the filename for use in later cells
#vars example_vars
message: hello vars
#play
name: hello world
hosts: localhost
gather_facts: false
vars_files:
- example_vars
This takes an argument in order to create a templated file that can be used in later cells
#template hello.j2
{{ message }}
#task
template:
src: hello.j2
dest: /tmp/hello
Provides overrides typically found in ansible.cfg
#ansible.cfg
[defaults]
host_key_checking=False
You can find various example notebooks in the repository
It's possible to use whatever python development process you feel comfortable with. The repository itself includes mechanisms for using pipenv
pipenv install
...
pipenv shell
Author: ansible
Source Code: https://github.com/ansible/ansible-jupyter-kernel
License: Apache-2.0 License
1594368382
Looking to develop real-time applications?
Hire Dedicated Linux Developer from HourlyDeveloper.io, we have dedicated developers who have vast experience in developing applications for Linux and UNIX operating systems and have in-depth knowledge of their processes, kernel tools, internal architectures, and development packages.
Consult with experts:- https://bit.ly/2ZQ5ySP
#hire linux dedicated developer #linux developer #linux development company #linux development services #linux development #linux developer
1603415915
This article is all about my journey on switching from Windows 10 to Linux Mint 20, how I got easily adapted to the Linux environment, and some resources that helped me to set up a perfect Desktop environment.
Ok, now I have decided to switch to Linux but here comes the first question. Which distro will satisfy my needs both in terms of GUI and other aspects? Linux is not something new to me since I have been working with RHEL based distros in my work for the past 4 years with the command-line.
I know RHEL based distros are good for enterprises but not for personalized desktop environments, at least that’s what I am thinking till now. So I started my research to find the distro that should be easy for me to use and at the same time should have good community support if in case I ran into some problem. Among many Linux distros, I drilled down my list to 4 flavors.
Related Article: The Best Linux Distributions for Beginners
Before deciding the Distro it is necessary you formulate the list of tools/programs or packages needed and check if the distro you choose provides all those features.
For me, I use Linux for two main purposes: one is for my professional development work, writing articles, and second for my personal use like Video editing and Movies. Most of the popular software are created to be compatible with Windows, macOS, and Linux like Sublime Text, VSCode, VLC Media Player, Firefox/Chromium browser. Other than these software, cloud-based services make our life easy Like Microsoft Office 365 or G Suite.
#linux distros #linux mint #linux distros #linux mint tips #linux
1599742800
Ubuntu is arguably one of the most popular and widely-used Linux distribution owing to its classic UI, stability, user-friendliness, and a rich repository that contains over 50,000 software packages. Furthermore, it comes highly recommended for beginners who are trying to give a shot at Linux.
In addition, Ubuntu is supported by a vast community of dedicated opensource developers who actively maintain contribute to its development to deliver up-to-date software packages, updates, and bug-fixes.
There are numerous flavors based on Ubuntu, and a common misconception is that they are all the same. While they may be based on Ubuntu, each flavor ships with its own unique style and variations to make it stand out from the rest.
In this guide, we are going to explore some of the most popular Ubuntu-based Linux variants.
Used by millions around the globe, Linux Mint is a massively popular Linux flavor based off of Ubuntu. It provides a sleek UI with out-of-the-box applications for everyday use such as LibreOffice suite, Firefox, Pidgin, Thunderbird, and multimedia apps such as VLC and Audacious media players.
Linux Mint Desktop
Owing to its simplicity and ease-of-use, Mint is considered ideal for beginners who are making a transition from Windows to Linux and those who prefer to steer clear from the default GNOME desktop but still enjoy the stability and the same code base that Ubuntu provides.
The latest Mint release is Linux Mint 20 and is based on the Ubuntu 20.04 LTS.
#linux distros #ubuntu #linux distros #ubuntu linux distributions #linux