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
#!/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" \
@vijayksingh
vijayksingh / list.md
Created October 1, 2022 06:50
Youtube Hidden Gem
@Widdershin
Widdershin / ssr.md
Last active May 1, 2024 17:36
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

@vrslev
vrslev / main.py
Last active November 3, 2024 15:35
Automatic browser reloading in FastAPI
import os
import arel
from fastapi import FastAPI, Request
from fastapi.templating import Jinja2Templates
app = FastAPI()
templates = Jinja2Templates("templates")
if _debug := os.getenv("DEBUG"):
@bmorrisondev
bmorrisondev / notion-sync.py
Created March 2, 2021 22:16
Sync Todoist Tasks to a Notion Database
from notion.client import NotionClient
import requests
import schedule
import time
from datetime import datetime
def get_todoist_tasks():
token = "todoist_token"
headers = {
@melvic-ybanez
melvic-ybanez / what-i-didnt-know-about-fp-2020.md
Last active August 1, 2024 08:25
What I Didn't Know about Functional Programming until 2020

What I Didn't Know about Functional Programming until 2020

  1. Programming using a series of transformations and aggregations, something I've been doing for years, is known as programming in the map/reduce style.
  2. The more abstract the type is, the greater its cardinality, and the smaller the set of operations it supports. So make use of universal quantifiers, particularly by implementing fully parametric functions. They guide you on how to implement their term-level definitions by narrowing down the number of possible implementations. In other words, the type system of Scala (or Haskell, for that matter) is not only great for capturing compile-time errors, but is also capable of leading you to the correct solution.
  3. You can encode union types by combining different Scala features such as type constructors, subtyping and implicits, and by taking advantage of the Curry-Howard Isomorphism and De Morgan's Laws for neg
@jamescalam
jamescalam / flask_api.py
Last active September 10, 2024 20:13
A example API using Flask
from flask import Flask
from flask_restful import Resource, Api, reqparse
import pandas as pd
import ast
app = Flask(__name__)
api = Api(app)
class Users(Resource):
def get(self):
@muff-in
muff-in / resources.md
Last active October 17, 2024 22:10
A curated list of Assembly Language / Reversing / Malware Analysis / Game Hacking-resources
@cedrickchee
cedrickchee / rust_resources.md
Last active October 15, 2024 18:14
Awesome Rust — a collection of resources for learning Rust

Awesome Rust

I learn Rust by reading The Rust Programming Language (aka. TRPL) book.

This is my mind map and collection of resources for learning Rust in early 2019.

I plan to continuously update this list if time allows in future. I will move this into its own GitHub repo or something more permanent when this grow.


@parmentf
parmentf / ConventionalCommitsEmoji.md
Last active October 20, 2024 20:58
Emoji for Conventional Commits
Type Emoji code
feat :sparkles:
fix 🐛 :bug:
docs 📚 :books:
style 💎 :gem:
refactor 🔨 :hammer:
perf 🚀 :rocket:
test 🚨 :rotating_light:
build 📦 :package: