- GitHub Staff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR commit checker | |
on: pull_request | |
jobs: | |
get-commits: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get PR commits | |
run: | | |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o out.json ${{ github.event.pull_request.commits_url }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In yapf >0.27.0, behaviour of default behaviour around SPLIT_BEFORE_FIRST_ARGUMENT | |
# changed. This overrides this. Put in top level of your directory with | |
# .pre-commit-config.yml file. | |
[style] | |
based_on_style = pep8 | |
split_before_first_argument = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# May need to do | |
# $ bind -f ~/.inputrc | |
# to get these to work | |
"\e[A": history-search-backward | |
"\e[B": history-search-forward | |
"\e[C": forward-char | |
"\e[D": backward-char |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hack job script to get correct audio profile on my bluetooth headphones | |
# Replace DEVICE_ID with your device's ID | |
# From https://askubuntu.com/a/773391 | |
DEVICE_ID="04:5D:4B:DE:CF:8E" | |
pacmd set-card-profile `pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}'` off; sleep 2 ; echo -e "disconnect $DEVICE_ID\n quit"|bluetoothctl;sleep 5; echo -e "connect $DEVICE_ID\n quit"|bluetoothctl; sleep 5; pacmd set-card-profile `pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}'` a2dp_sink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default_language_version: | |
python: python3.7 | |
default_stages: [commit, push] | |
fail_fast: false | |
repos: | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v2.2.3 | |
hooks: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
""" | |
Checks file size of committed files. If there are stage files bigger than a | |
given size (`WARN_SIZE_MB`) then | |
* the commit is aborted | |
* you are told about the offending files | |
* you are told the command for forcing through the commit anyway | |
Save this file as "pre-commit" in your .git/hooks folder and do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
""" | |
Toy example using DumpObject, a way of periodically dumping out large objects to | |
file as it grows. This example watches a file directory and creates a dictionary | |
with | |
* key: file name | |
* value: first line of file | |
Includes use of `watchdog` to watch for real time effects (here: new files | |
being created in the directory) and `atexit` to gracefully deal with the program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE=5000 | |
HISTFILESIZE=10000 | |
# Setup default editor | |
export EDITOR=subl | |
# Start ssh agent so can ssh to Git | |
eval "$(ssh-agent -s)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To be run in sudo's crontab. Access via sudo crontab -e | |
# You need to pick a channel first: | |
# $ echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list | |
# OR | |
# $ echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list | |
echo $(date) | |
apt-get update && apt-get install sublime-text | |
apt autoremove -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
"""Runs autoflake on commit. Blocks commit and requests adding changed files | |
if autoflake fires. | |
Installation | |
------------ | |
1. You will need to install autoflake: https://pypi.org/project/autoflake/ | |
$ pip install --upgrade autoflake | |
or |
NewerOlder