Skip to content

Instantly share code, notes, and snippets.

@kolay-v
kolay-v / 1markdown.ts
Last active April 25, 2025 01:46
Markdown to telegram entities
import remarkMath from "npm:remark-math";
import remarkParse from "npm:remark-parse";
import { unified } from "npm:unified";
import { type MessageEntity } from "npm:grammy/types";
// @deno-types="npm:@types/mdast"
import type { RootContent } from "npm:mdast";
export function mdV2(markdown: string) {
const processor = unified().use(remarkParse).use(remarkMath);
@lavafroth
lavafroth / config.toml
Created March 27, 2024 03:10
Helix config for lazygit integration
[keys.normal]
C-g = [":new", ":insert-output lazygit", ":buffer-close!", ":redraw"]
@sebastiancarlos
sebastiancarlos / show_notifications.bash
Last active July 23, 2024 08:43
Show notifications in your terminal
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/shorts/WVyqVkGYb4k
# Add this somewhere in ~/.bashrc
# write_message
# - write a message on the lower right corner of the terminal
function write_message () {
if [[ "$#" -eq 0 ]]; then
@bashbunni
bashbunni / .zshrc
Created October 27, 2022 21:41
CLI Pomodoro for Mac
# I'll be doing another one for Linux, but this one will give you
# a pop up notification and sound alert (using the built-in sounds for macOS)
# Requires https://github.com/caarlos0/timer to be installed
# Mac setup for pomo
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\
-title 'Work Timer is up! Take a Break 😊'\
-appIcon '~/Pictures/pumpkin.png'\
-sound Crystal"
@sammachin
sammachin / README.md
Last active December 18, 2024 08:33
Raspberry Pi PicoW MQTT-GPIO With Node-RED

This will require the umqtt.simple library on the PicoW,

You can install this with upip by running:

import upip
upip.install('umqtt.simple')

If you use a public MQTT broker such as test.mosquitto.org you should change the prefix value in line 8 of the micropython from MYNAME to something unique or you may recieve other peoples commands

@konstantin24121
konstantin24121 / verifyTelegramWebAppData.tsx
Last active March 28, 2025 17:36
Telegram Bot 6.0 Validating data received via the Web App node implementation
const TELEGRAM_BOT_TOKEN = '110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw'; // https://core.telegram.org/bots#creating-a-new-bot
export const verifyTelegramWebAppData = async (telegramInitData: string): boolean => {
// The data is a query string, which is composed of a series of field-value pairs.
const encoded = decodeURIComponent(telegramInitData);
// HMAC-SHA-256 signature of the bot's token with the constant string WebAppData used as a key.
const secret = crypto
@brunomsantiago
brunomsantiago / app.py
Last active December 1, 2023 11:29
Streamlit keyboard shortcuts to buttons (tested on streamlit 1.4.0)
import streamlit as st
import streamlit.components.v1 as components
def left_callback():
st.write('Left button was clicked')
def right_callback():
st.write('Right button was clicked')
@dody87
dody87 / command_only_show_my_ip_mac
Last active May 4, 2024 09:55
Simple command to show your IP and nothing else on MacOS
# Step 1: open terminal.
# Step 2: nano ~/.bash_profile
# Step 3: Add the following code below
alias my-ip='ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2'
# Step 4: save file and restart terminal.
@shawwwn
shawwwn / uping.py
Last active March 24, 2025 09:43
µPing: Ping library for MicroPython
# µPing (MicroPing) for MicroPython
# copyright (c) 2018 Shawwwn <[email protected]>
# License: MIT
# Internet Checksum Algorithm
# Author: Olav Morken
# https://github.com/olavmrk/python-ping/blob/master/ping.py
# @data: bytes
def checksum(data):
if len(data) & 0x1: # Odd number of bytes
@ali1234
ali1234 / clock.py
Created March 2, 2018 14:54
scroll phat hd clock
#!/usr/bin/env python
import time
import signal
import math
import scrollphathd
from envirophat import light, motion, weather
"""