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/perl | |
# This filter changes all words to Title Caps, and attempts to be clever | |
# about *un*capitalizing small words like a/an/the in the input. | |
# | |
# The list of "small words" which are not capped comes from | |
# the New York Times Manual of Style, plus 'vs' and 'v'. | |
# | |
# 10 May 2008 | |
# Original version by John Gruber: |
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
// Based on information provided on | |
// https://omni-automation.com/omnioutliner/item.html | |
// Get selected nodes in foremost window (editors[0]) | |
var nodes = document.editors[0].selectedNodes | |
// Split all selected topics in paragraphs | |
nodes.forEach( | |
function(node) { | |
// for each individual node |
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
def is_power_of_two(an_int): | |
# We use the binary representation to work with | |
bits = bin(an_int)[2:] # truncates the "0b" part of the string | |
# A power of two only has one bit set, so the sum of all bits needs to be 1 | |
return sum([int(x) for x in list(bits)]) == 1 | |
def is_power_of_two_recursive(an_int): | |
if an_int < 0: | |
return is_power_of_two_recursive(-an_int) | |
elif an_int == 0: |
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
string = input("Which string you want to vowel-reverse?\n> ") | |
listed_string = list(string) | |
# Helper function to find whether a character is a vowel | |
def is_vowel(c): | |
"""Determines is c is a vowel; returns False if it is not, True if it is.""" | |
result = False | |
vowel_list = list("aeiou") | |
try: | |
position = vowel_list.index(c) |
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/env python | |
# Based on https://m.xkcd.com/936/ | |
import random | |
dict_file = open('/usr/share/dict/words', 'r') # substitute with the path your /etc/dict/words equivalent | |
word_list = [x.rstrip('\n') for x in dict_file.readlines()] | |
capitalise_first_letter = True | |
capitalise_first_word = False | |
joiner_character = "-" |
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
-- PurpleAir station ID | |
set theStationID to "6732" | |
tell application "JSON Helper" | |
set theWeather to (fetch JSON from ("https://www.purpleair.com/json?show=" & theStationID) with cleaning feed) | |
set theStatsA to (read JSON from (Stats of item 1 of results of theWeather)) | |
set theStatsB to (read JSON from (Stats of item 2 of results of theWeather)) | |
set theLocation to Label of item 1 of results of theWeather | |
set theLat to (Lat of item 1 of results of theWeather) | |
set theLon to (Lon of item 1 of results of theWeather) |
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/env bash | |
# ~/.macos — https://mths.be/macos | |
# Close any open System Preferences panes, to prevent them from overriding | |
# settings we’re about to change | |
osascript -e 'tell application "System Preferences" to quit' | |
# Ask for the administrator password upfront | |
sudo -v |
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
# http://www.graphviz.org/content/cluster | |
digraph G { | |
graph [fontname = "Handlee"]; | |
node [fontname = "Handlee"]; | |
edge [fontname = "Handlee"]; | |
bgcolor=transparent; | |
subgraph cluster_0 { |
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/env python | |
# Based on https://chuoi.org/posts/checkexchangeemailandsendemailwithpython/ | |
"""Description | |
A Python script to check email exchange mailbox, download require attachment and send email to user. | |
Use: | |
cd /path/to/file && python3 main.py | |
""" | |
import os |
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
""" | |
Contains some faster coordinate transformations than the ones currently used in astropy. | |
This is based on an idea put forward by @bwinkel in the pull request located at | |
at https://github.com/astropy/astropy/pull/6068. This may be merged into the astropy | |
master at some point. If this happens, this module can be removed. | |
Simply import into code to experience the speedups; the astropy coordinate transforms are | |
overwritten on modeul import. | |
""" |