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
------------------------------------------------------------------------- | |
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005 | |
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5 | |
Latest version of this file (in English) is usually at: | |
http://sed.sourceforge.net/sed1line.txt | |
http://www.pement.org/sed/sed1line.txt | |
This file will also available in other languages: | |
Chinese - http://sed.sourceforge.net/sed1line_zh-CN.html |
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
HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008 | |
Compiled by Eric Pement - eric [at] pement.org version 0.27 | |
Latest version of this file (in English) is usually at: | |
http://www.pement.org/awk/awk1line.txt | |
This file will also be available in other languages: | |
Chinese - http://ximix.org/translation/awk1line_zh-CN.txt | |
USAGE: |
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
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
// Strategy pattern. | |
// The computer player's behavior/strategy can be replaced by inheriting from the interface below | |
// Also, the human player's behavior inherits from the same interface | |
// This also makes it easy to modify the game for 2 human players, 2 computer players etc. | |
interface MoveMethod |
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
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
// Strategy pattern. | |
// The computer player's behavior/strategy can be replaced by inheriting from the interface below | |
// Also, the human player's behavior inherits from the same interface | |
// This also makes it easy to modify the game for 2 human players, 2 computer players etc. | |
interface MoveMethod |
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
https://dev-api.gemshare.com/secure/questions/242/responses?token=07f87b6a92cb4dc98524174d511159eb | |
search for "Big Dog Surf Camp" | |
The recommender Nicki Storm is not in my network so her recommendation doesn't appear on the gem details page | |
{ | |
"responses_yes": [ | |
{ | |
"relationship": { | |
"myself": false, |
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
https://dev-api.gemshare.com/secure/questions/295/responses?token=07f87b6a92cb4dc98524174d511159eb | |
{ | |
"responses_yes": [{ | |
"relationship": { | |
"myself": false, | |
"via_text": null, | |
"direct": true, | |
"out_of_network": false | |
}, |
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
import math | |
import sys | |
import uuid | |
# this is taken from: https://gist.github.com/bhelx/778542 | |
# modified to support long | |
class UrlShortener: | |
BASE = 62 | |
UPPERCASE_OFFSET = 55 | |
LOWERCASE_OFFSET = 61 |
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 | |
# | |
# Converts any integer into a base [BASE] number. I have chosen 62 | |
# as it is meant to represent the integers using all the alphanumeric | |
# characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
# | |
# I plan on using this to shorten the representation of possibly long ids, | |
# a la url shortenters | |
# |