Skip to content

Instantly share code, notes, and snippets.

View yazdipour's full-sized avatar
:shipit:
Noob

Shahriar yazdipour

:shipit:
Noob
View GitHub Profile
@yazdipour
yazdipour / mqtt.py
Created March 27, 2020 22:58
Python MQTT Pub/Sub
import paho.mqtt.client as mqtt #pip install paho.mqtt
client = mqtt.Client()
client.username_pw_set(username="testuser",password="testpass")
client.connect("192.168.0.101", 1883)
# PUBLISH
client.publish("Topic", "hello server")
# SUBSCRIBE
@yazdipour
yazdipour / mit_downloader.py
Created December 15, 2019 08:16
ocw.mit.edu download link finder
import sys
import urllib
import os
from HTMLParser import HTMLParser
from pathlib import Path
import time
base_url = 'http://ocw.mit.edu'
lec_url_list = []
video_url_list = []
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
$ curl -s "https://crawler.ninja/files/security-txt-values.txt" | grep -i "hiring: http" | sed 's/^#//g' | awk '{print $2}'
https://www.tumblr.com/jobs
https://kariera.shoptet.cz/
https://g.co/SecurityPrivacyEngJobs
https://www.shopify.com/careers
https://solarwinds.jobs
https://www.chcidozootu.cz/it-devel/
https://careerssearch.bbc.co.uk/jobs/search
https://www.npmjs.com/jobs
https://grab.careers/
#src https://8192.one/post/ssh_login_notification_withtelegram/
USERID="<Enter_the_user_id_of_the_recipient>"
KEY="<The_key_of_your_telegram_bot>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")" #Collect date & time.
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt' #Create a temporary file to keep data in.
if [ -n "$SSH_CLIENT" ] && [ -z "$TMUX" ]; then #Trigger
IP=$(echo $SSH_CLIENT | awk '{print $1}') #Get Client IP address.
// Code for website
// This is the "Offline page" service worker
//Add this below content to your HTML page, or add the js file to your page at the very top to register service worker
if (navigator.serviceWorker.controller) {
console.log('[PWA Builder] active service worker found, no need to register')
} else {
//Register the ServiceWorker
navigator.serviceWorker.register('pwabuider-sw.js', {
scope: './'
var config={
homeURL:'https://www.dideo.ir',
updatePageURL: 'http://blog.dideo.ir/?p=629',
installURL:'http://blog.dideo.ir/?p=218'
};
var enable = kango.storage.getItem('enable');
if (enable == undefined){
enable = true;
kango.storage.setItem('enable', true);
# 05_h.png >> 05_half.png
for file in *.png; do mv "$file" "${file/_h.png/_half.png}"; echo $f;done
# * >> *.mp4
for file in *; do mv "$file" "$file.mp4";done
# */*/ -rec >> remove *.pdf && *.doc
IFS=$'\n'; set -f ## To skip problem of directories with spaces
for f in $(find . -name '*.pdf' -or -name '*.doc'); do rm "$f"; echo $f;done
unset IFS; set +f