Skip to content

Instantly share code, notes, and snippets.

View hehuan2112's full-sized avatar
🏠
Working from home

Huan He hehuan2112

🏠
Working from home
View GitHub Profile
@ihor-lev
ihor-lev / sublime_fix_home_end_keys.md
Last active September 6, 2024 07:01
Fix Sublime Text Home and End key usage on Mac OSX

Sublime Text Home/End keys default functionality jumps to the beginning and end of the file.

Fix Home and End keys to move the cursor to the beginning and end of lines.

Preferences > Key Bindings - User

Adding the following to the array:

{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
@brews
brews / fetchmeta.py
Last active February 5, 2024 17:48 — forked from jrsmith3/doi2bib.py
Python function to access crossref.org DOI metadata resolver and return bibliography as dictionary or bibtex string.
import requests
import json
def fetchmeta(doi, fmt='dict', **kwargs):
"""Fetch metadata for a given DOI.
Parameters
----------
doi : str
@dlaptev
dlaptev / push_notifications_to_telegram.md
Last active September 22, 2024 07:34
Programmatically send push notifications to telegram from python
  1. Create a new Telegram bot:
    1. start a chat with BotFather;
    2. type /newbot, select a name (to be shown in chats) and handle for your bot;
    3. note the bot token to access HTTP API - a long string with a colon in the middle (later referred to as <token>);
    4. optionally /setdescription and /setuserpic.
  2. Add the bot to the chat/channel and note its id:
    1. add the bot to a new or existing chat or group - this is where your bot will send notifications to;
    2. go to https://api.telegram.org/bot<token>/getUpdates (replace <token> with your token);
    3. within the chat part, find and note the id field - a positive or negative number (later referred to as <chat_id>).
  3. Programmatically send notifications: