- Put SugaryNewFileCommand.py under Packages/User
- Add new key binding
{ "keys": ["super+n"], "command": "sugary_new_file" }
- Done.
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
#!/bin/bash | |
# Fix DNS recornds after Cisco AnyConnect connection | |
sudo scutil << EOF | |
open | |
get State:/Network/Service/com.cisco.anyconnect/DNS | |
d.add ServerAddresses * 127.0.0.1 | |
set State:/Network/Service/com.cisco.anyconnect/DNS | |
quit |
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
#!/bin/bash | |
# Tanks to: https://gist.github.com/ogrrd/5831371 | |
# Update your homebrew installation | |
brew up | |
# Install dnsmasq | |
brew install dnsmasq | |
mkdir -pv $(brew --prefix)/etc/ |
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
#!/bin/bash | |
if [[ -n $DEBUG ]]; then | |
set -xe | |
fi | |
ldap_password_keychain_name=LDAP | |
second_factor_secret_keychain_name=2Factor | |
vpn_server=$2 | |
vpn_group_index=$3 |
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
-- 1. To authorize via Touch ID you must apply this script: https://gist.github.com/RichardBronosky/31660eb4b0f0ba5e673b9bc3c9148a70 | |
-- 2. Create a new password entry in Keychain Access called "LDAP" with your ldap password | |
-- 3. Create a new password entry in Keychain Access called "2Factor" with your 2factor token | |
-- 4. Install oath-toolkit. (brew install oath-toolkit) | |
-- 5. Open this script in Script Editor (both this and the above are in the Applications->Utilities folder) and "Save as.." an Application (.app) with desired name. | |
-- 6. Open Security & Privacy System Preferences, go to Privacy, Accessibility. | |
-- 7. Enable the above .app so it can access Accessibility | |
-- 8. Add the new .app to /Users/[yourshortname]/Applications with a shortcut to your Dock | |
-- 9. Enjoy the fast connection with no need to enter password and increased security of not having a sensitive password stored as plain text. |
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
#!/bin/bash | |
# curl -sL https://gist.githubusercontent.com/RichardBronosky/31660eb4b0f0ba5e673b9bc3c9148a70/raw/touchid_sudo.sh | bash | |
# This script is ready to copy-paste in whole, or just the line above (without the leading #) | |
# Use TouchID for sudo on modern MacBook Pro machines | |
# This script adds a single line to the top of the PAM configuration for sudo | |
# See: https://apple.stackexchange.com/q/259093/41827 for more info. | |
touchid_sudo(){ |
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
from rest_framework import serializers | |
from django.db.models.manager import Manager | |
from django.db.models.query import QuerySet | |
class LimitQuerySetSerializerFieldMixin: | |
""" | |
Serializer mixin with a special `get_queryset()` method that lets you pass |
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
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import create_engine | |
from sqlalchemy import Column, Integer, String | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy import ForeignKey | |
from sqlalchemy.orm import relationship, backref | |
from kivy.graphics import Rectangle | |
from kivy.uix.boxlayout import BoxLayout | |
from kivy.uix.label import Label | |
from kivy.uix.widget import Widget |
In python, you have floats and decimals that can be rounded. If you care about the accuracy of rounding, use decimal type. If you use floats, you will have issues with accuracy.
All the examples use demical types, except for the original value, which is automatically casted as a float.
To set the context of what we are working with, let's start with an original value.
NewerOlder