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 | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
gh_url = 'https://api.github.com' | |
req = urllib2.Request(gh_url) | |
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |
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
scp yzhang@linux04.cs.uh.edu:~/packages/scidb-15.7.0.9267.tgz ./ | |
tar -xzf scidb-15.7.0.9267.tgz | |
mv scidb-15.7.0.9267/ scidbtrunk | |
sudo apt-get update | |
sudo apt-get -y install subversion expect openssh-server openssh-client | |
# The following environment variables should go into ~/.bashrc | |
export SCIDB_VER="15.7" | |
export SCIDB_SOURCE_PATH="/home/scidb/scidbtrunk" |
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
//a somewhat contrived example of how reactive programming can be useful | |
//some real concerns that are omitted, but can be easily accomplished using rxswift are | |
//error handling, displaying loading indicators, etc | |
// A result object that comes from the network. | |
// The contents are irrelevant for this example. | |
struct Result { | |
let text: String | |
let someOtherThing: String |
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
right_of(X, Y) :- X is Y+1. | |
left_of(X, Y) :- right_of(Y, X). | |
next_to(X, Y) :- right_of(X, Y). | |
next_to(X, Y) :- left_of(X, Y). | |
solution(Street, FishOwner) :- | |
Street = [ | |
house(1, Nationality1, Color1, Pet1, Drinks1, Smokes1), | |
house(2, Nationality2, Color2, Pet2, Drinks2, Smokes2), |
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 | |
# Generates gource video (h.264) out of multiple repositories. | |
# Pass the repositories in command line arguments. | |
# Example: | |
# <gource-multirepo.sh> /path/to/repo1 /path/to/repo2 | |
RESOLUTION="1600x1080" | |
outfile="gource.mp4" | |
i=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/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
-- 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
""" | |
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. | |
""" |
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
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: pink; icon-glyph: user; | |
// In order to use the script, you must create a Slack app and install it on your workspace. Go here to create your app: api.slack.com/apps | |
// There's two important configurations you must make to the app: | |
// 1. Add the users.profile:write scope to the app. This scope is necessary to set a Slack status. | |
// 2. Add the following redirect URL, so Slack will redirect to Scriptable after authorizing. | |
// https://open.scriptable.app | |
// Run the script to grant your newly created app authorization to access your Slack account. After you've done this, you can use the script in Shortcuts. |
NewerOlder