Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
@pythoninthegrass
pythoninthegrass / osascript_close_windows.sh
Last active November 1, 2022 17:11 — forked from Koze/CloseAllWindows.scpt
Close all windows with AppleScript
#!/usr/bin/env bash
# SOURCE: https://gist.github.com/Koze/2e1a9bf967b2bf865fc9
# close all windows (e.g., thousands of finder windows from unarchiver)
osascript -e 'tell application "Finder" to close windows'
## index 1 is frontmost window
# osascript 'tell application "Finder" to close window 1'
@pythoninthegrass
pythoninthegrass / clean_code.md
Created May 24, 2022 04:55 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@pythoninthegrass
pythoninthegrass / get-oauth2-token-meetup-api
Created May 4, 2022 07:03 — forked from valeriocos/get-oauth2-token-meetup-api
Get a bearer/OAuth2 token for Meetup application-only requests in Python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# 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 3 of the License, or
# (at your option) any later version.
#
@pythoninthegrass
pythoninthegrass / config
Created March 19, 2022 02:15 — forked from miguelmota/config
Arch linux VNC server setup
session=lxqt
geometry=1920x1080
localhost # comment this out to allow connections from anywhere
alwaysshared
@pythoninthegrass
pythoninthegrass / beautiful_idiomatic_python.md
Created January 28, 2022 22:03 — forked from 0x4D31/beautiful_idiomatic_python.md
[Beautiful Idiomatic Python] Transforming Code into Beautiful, Idiomatic Python #python

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@pythoninthegrass
pythoninthegrass / remove_completed_torrents.sh
Last active June 21, 2021 06:53 — forked from root-hal9000/removecompletedtorrents.sh
Transmission-Daemon: Remove Completed Torrents
#!/usr/bin/env bash
# SOURCE: https://gist.github.com/ffcruz85/6c9fb792fce4af0c4cb561fd653c86b6
# Script to check for complete torrents in transmission folder, then stop and move them
# either hard-code the MOVEDIR variable here…
MOVEDIR='/data/complete'
# TODO: read $env vars or file
@pythoninthegrass
pythoninthegrass / LICENSE
Created June 7, 2021 20:01 — forked from noelbundick/LICENSE
Exclude WSL installations from Windows Defender realtime protection
MIT License
Copyright (c) 2018 Noel Bundick
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@pythoninthegrass
pythoninthegrass / MegaPKGr.zsh
Last active May 28, 2021 23:59 — forked from talkingmoose/MegaPKGr.zsh
The pkgbuild binary and Jamf Composer don't support adding single files of 8 GB or more to a package. Some apps like Install macOS Big Sur.app include files larger than 8 GB in their bundles. This script will create a deployable PKG file from apps whose bundles include those large files.
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by: William Smith
Professional Services Engineer
Jamf
[email protected]
https://gist.github.com/e9ed319226c6da30dd633725e48a97b0
@pythoninthegrass
pythoninthegrass / ccdl.command
Last active April 10, 2021 01:27 — forked from ayyybe/ccdl.command
Adobe Offline Package Generator v0.1.2 (macOS only)
#!/bin/bash
CYAN="$(tput bold; tput setaf 6)"
RESET="$(tput sgr0)"
clear
if command -v python3 > /dev/null 2>&1; then
if [ $(python3 -c "print('ye')") = "ye" ]; then
clear