Skip to content

Instantly share code, notes, and snippets.

View ashleymavericks's full-sized avatar
⛏️
Tinkering with RasPi's

Anurag Singh ashleymavericks

⛏️
Tinkering with RasPi's
View GitHub Profile
@ashleymavericks
ashleymavericks / gist:dd4ca9650758ceb734cebe5424b92586
Created July 9, 2020 09:17 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
Type Emoji code
feat :sparkles:
fix 🐛 :bug:
docs 📚 :books:
style 💎 :gem:
refactor 🔨 :hammer:
perf 🚀 :rocket:
test 🚨 :rotating_light:
build 📦 :package:
@ashleymavericks
ashleymavericks / latency.txt
Created June 10, 2022 08:43 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@ashleymavericks
ashleymavericks / broad_market_nse.sh
Last active January 31, 2023 22:55
Broad Market NSE indices
#!/bin/bash
# fetch csv using wget and write to stdout -> remove header row from the csv -> replace &/- with _ -> select only stock_symbol column -> finally redirect output to a text file
# using cut
wget -O - https://www1.nseindia.com/content/indices/ind_nifty50list.csv | sed 1d | sed 's/[&-]/_/g' | cut -d ',' -f 3 > "Broad 5 - Microcap 250".txt
# using awk
wget -O - https://www1.nseindia.com/content/indices/ind_niftymicrocap250_list.csv | sed 1d | sed 's/[&-]/_/g' | awk -F ',' '{print $3}' > "Broad 5 - Microcap 250".txt
@ashleymavericks
ashleymavericks / requests_exceptions_pattern.py
Created July 16, 2023 01:40
Quick pattern to handle exceptions with requests module
import time
import sys
from http import HTTPStatus
import requests
from requests.exceptions import HTTPError
url = "https://theurl.com"
retries = 3
retry_codes = [
@ashleymavericks
ashleymavericks / pi-hole-nginx.txt
Created September 4, 2023 01:20
Pi-Hole with Nginx Reverse Proxy, redirection to /admin
# Pihole /admin/ Fix
location / {
proxy_pass http://192.168.0.100:1010/admin/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header X-Frame-Options;
proxy_set_header X-Frame-Options "SAMEORIGIN";
proxy_read_timeout 90;
}
#!/bin/bash
BOT_TOKEN="<token>"
CHAT_ID="<id>"
TELEGRAM_USERNAME="<username>"
send_telegram_message() {
local message="$1"
curl -s -X POST "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" \
-d chat_id="$CHAT_ID" \