Skip to content

Instantly share code, notes, and snippets.

View sidward35's full-sized avatar

Siddharth Mathur sidward35

View GitHub Profile
@sidward35
sidward35 / index.html
Created June 6, 2019 15:41
Horizontal scrolling text in HTML
<marquee behavior="scroll" bgcolor="yellow" loop="-1" width="30%">
<i>
<font color="blue">
Today's date is :
<strong>
<span id="time"></span>
</strong>
</font>
</i>
</marquee>
@sidward35
sidward35 / btc_notifs.py
Created September 21, 2019 19:32
Python script that sends IFTTT notifications when Bitcoin price drops below threshold
import requests
import time
#make sure you change the event name and key below
IFTTT_WEBHOOKS_URL = 'https://maker.ifttt.com/trigger/EVENT_NAME/with/key/YOUR_KEY_HERE'
BITCOIN_API_URL = 'https://api.coinmarketcap.com/v1/ticker/bitcoin/'
BITCOIN_PRICE_THRESHOLD = 9500
def get_latest_bitcoin_price():
response = requests.get(BITCOIN_API_URL)
@sidward35
sidward35 / MainActivity.java
Created January 7, 2020 10:06
Get index of nth occurrence of substring from String in Java
public int ordinalIndexOf(String str, String substr, int n) {
int pos = str.indexOf(substr);
while (--n > 0 && pos != -1)
pos = str.indexOf(substr, pos + 1);
return pos;
}
@sidward35
sidward35 / grafana-on-heroku.sh
Created November 9, 2020 19:07
Deploys a Grafana installation to Heroku (user input required for postgres setup)
#!/bin/bash
sudo apt-get install git postgresql
curl https://cli-assets.heroku.com/install.sh | sh
git clone https://github.com/eliperelman/heroku-grafana.git
cd heroku-grafana
heroku create
heroku buildpacks:add http://github.com/ryandotsmith/null-buildpack.git
@sidward35
sidward35 / btc_price_checker.py
Last active February 3, 2021 04:03
Fetches the current Bitcoin price in USD and saves it to a local file
import requests
import json
import time
from datetime import datetime
while True:
response = requests.get('https://api.coindesk.com/v1/bpi/currentprice.json')
price = response.json().get('bpi').get('USD').get('rate')
now = datetime.now()
@sidward35
sidward35 / hosts
Last active August 6, 2026 01:12
Adlist for Pi-hole with domains for Roku, LG, and Samsung
# Roku block list
#----------------------------------
0.0.0.0 p.ads.roku.com
0.0.0.0 tyler.logs.roku.com
0.0.0.0 giga.logs.roku.com
0.0.0.0 cooper.logs.roku.com
0.0.0.0 cloudservices.roku.com
0.0.0.0 assets.sr.roku.com
0.0.0.0 prod.mobile.roku.com
0.0.0.0 wwwimg.roku.com
@sidward35
sidward35 / golinks-nextcloud-setup.sh
Last active May 12, 2021 19:29
Script to set up Golinks, Pi-hole, and Nextcloud on Linux
@sidward35
sidward35 / splunk_install.sh
Last active August 10, 2021 18:16
Script to setup Splunk on Debian
#!/bin/sh
sudo apt update
#sudo apt install neofetch
#neofetch
#echo 'neofetch' >> ~/.bashrc
sudo apt install wget
wget -O splunk.tgz '{SPLUNK-DOWNLOAD-URL}'
tar -xzvf splunk.tgz
@sidward35
sidward35 / jupyter_server.sh
Created August 12, 2021 04:58
Script to setup a Jupyter server with Python3 on Debian 10
#!/bin/sh
sudo apt update
sudo apt install python3-pip python3-dev
sudo pip3 install --upgrade pip
pip install jupyter
jupyter notebook password
#sudo su
@sidward35
sidward35 / reddit_post.py
Created September 25, 2021 10:23
Post images to Reddit and add a comment
import praw
from datetime import date
def postFig(img_name, sub, flair=''):
creds = {
"client_id":"",
"client_secret":"",
"user_agent":"script by u/username",
"redirect_uri":"http://localhost:8080",
"refresh_token":""