Skip to content

Instantly share code, notes, and snippets.

@giridharmb
giridharmb / fetch.js
Created February 26, 2022 03:53 — forked from anil-pace/fetch.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<button id="myBtn">fetch it</button>
<script>
from rq_scheduler import Scheduler
queue = Queue('circle', connection=Redis())
scheduler = Scheduler(queue=queue)
scheduler.schedule(
scheduled_time=datetime.utcnow(), # Time for first execution, in UTC timezone
func=func, # Function to be queued
args=[arg1, arg2], # Arguments passed into function when executed
kwargs={'foo': 'bar'}, # Keyword arguments passed into function when executed
@giridharmb
giridharmb / python_crontab.py
Created October 21, 2021 19:10 — forked from pratik-choudhari/python_crontab.py
schedule with python crontab
from crontab import CronTab
cron = CronTab(user='root')
job = cron.new(command='my_script.sh')
job.hour.every(1)
cron.write()
import schedule
import time
def task():
print("Job Executing!")
# for every n minutes
schedule.every(10).minutes.do(task)
# every hour
import time
import threading
def task():
print("Job Completed!")
def schedule():
while 1:
task()
time.sleep(10)
import datetime
def task():
print("Job Completed!")
while 1:
now = datetime.datetime.now()
# schedule at every wednesday,7:45 pm
if now.weekday == 3 and now.strftime("%H:%m") == "19:45":
task()
@giridharmb
giridharmb / python-notes.md
Last active January 5, 2021 01:01
Python Notes

Nested Dict

nested_dict

pip install nested_dict
>>> from nested_dict import nested_dict
>>> nd= nested_dict()
>>> nd["one"] = "1"
@giridharmb
giridharmb / MACOSX-Notes.md
Last active May 10, 2024 14:46
Mac OSX Notes

Default Screenshot Location

defaults write com.apple.screencapture location /Users/user1/Desktop/screenshots

iCloud Drive - Create Soft Link

# ln -s /Users/user1/Library/Mobile\ Documents/com~apple~CloudDocs /Users/user1/icloud_drive
@giridharmb
giridharmb / linux-and-cli.md
Last active January 5, 2021 19:06
Linux, CLI & Tools

RSYNC

rsync -avh --stats --progress /data/dir1/ user1@host1.mycompant.com:/data/directory1/

rsync -avh --stats --progress --exclude "dir2" /Users/peter/ root@192.168.1.200:/root/backup1/

GREP

egrep --exclude-dir=node_modules/ -rn "component/{componentId}" *
@giridharmb
giridharmb / webui.md
Last active January 5, 2021 19:19
Web User Interfaces Notes

Center HTML5 Videos

<!DOCTYPE html>
<html>
<head>

<style>
.center {
    margin-left: auto;