Skip to content

Instantly share code, notes, and snippets.

View generic-github-user's full-sized avatar
📚
fervently skimming arXiv

Anna Allen generic-github-user

📚
fervently skimming arXiv
  • United States
View GitHub Profile
@jesugmz
jesugmz / Python-docstring-restructuredtext-style.rst
Last active April 24, 2024 14:34
Python docstring reStructuredText style

Python docstring reStructuredText style

Python Signatures

Signatures of functions, methods and class constructors can be given like they would be written in Python.

@joseluisq
joseluisq / stash_dropped.md
Last active March 28, 2024 11:59
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@Aerijo
Aerijo / making_language_grammar.md
Last active March 18, 2024 05:03
Guide to writing an Atom language grammar

A guide to writing a language grammar (TextMate) in Atom

Tree sitter

  • Atom is transitioning to an entirely new way of defining grammars using tree-sitter. This will be enabled by default quite soon now. It is theoretically faster and more powerful than regex based grammars (the one described in this guide), but requires a steeper learning curve. My understanding is that regex based grammars will still be supported however (at least until version 2), so this guide can still be useful. To enable it yourself, go to Settings -> Core and check Use Tree Sitter Parsers

Links for tree-sitter help:

@Aerijo
Aerijo / latex_in_atom.md
Last active July 31, 2023 09:31
Setting up Atom for LaTeX

Disclaimer: I wrote the packages language-latex2e, autocomplete-latex, latex-wordcount, and hyperclick-latex. I still try to provide a list of all useful packages though, so let me know if I have missed one.

This is a general guide for how to get started with LaTeX in Atom.

NOTE: This guide assumes you already have LaTeX installed on your computer. If you do not, I recommend TeX Live.

@LyleScott
LyleScott / rotate_2d_point.py
Last active May 1, 2024 21:26
Rotate X,Y (2D) coordinates around a point or origin in Python
"""
Lyle Scott, III // lyle@ls3.io
Multiple ways to rotate a 2D point around the origin / a point.
Timer benchmark results @ https://gist.github.com/LyleScott/d17e9d314fbe6fc29767d8c5c029c362
"""
from __future__ import print_function
import math
@jdhao
jdhao / resize_and_pad_image_to_square
Last active June 15, 2023 04:12
this script will resize and pad an image to desired square size and keep its aspect ratio unchanged. Before running the script, please change the size and image path to valid value.
from PIL import Image, ImageOps
import cv2
desired_size = 368
im_pth = "/home/jdhao/test.jpg"
# im = Image.open(im_pth)
# old_size = im.size # old_size[0] is in (width, height) format
# ratio = float(desired_size)/max(old_size)
@f-rumblefish
f-rumblefish / hello_simple_player.py
Last active January 7, 2023 01:50
Using pygame to play notes
# import library ---------------------------------------------------------------
import pygame.midi
import time
# define all the constant values -----------------------------------------------
device = 0 # device number in win10 laptop
instrument = 9 # http://www.ccarh.org/courses/253/handout/gminstruments/
note_Do = 48 # http://www.electronics.dit.ie/staff/tscarff/Music_technology/midi/midi_note_numbers_for_octaves.htm
note_Re = 50
note_Me = 52
@SKempin
SKempin / Git Subtree basics.md
Last active April 27, 2024 20:22
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 1, 2024 17:42
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@p2or
p2or / Blender_Basic-UI-Template_27.py
Last active January 22, 2024 19:03
Basic-UI-Template for Blender 2.7+ #Blender #BSE
# -> For a Blender 2.8+ version, go to https://gist.github.com/p2or/2947b1aa89141caae182526a8fc2bc5a
# https://blender.stackexchange.com/q/57306/3710, https://blender.stackexchange.com/q/79779/3710
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#