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 random | |
class Card: | |
def __init__(self, suit, value): | |
self.suit = suit | |
self.value = value | |
def __repr__(self): | |
return " of ".join((self.value, self.suit)) |
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
''' | |
Completed Blackjack program. Source Next Tech sandbox can be found at https://next.tech/projects/94217701d98d/share. | |
''' | |
import random | |
class Card: | |
def __init__(self, suit, value): | |
self.suit = suit | |
self.value = value |
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
package main | |
import "fmt" | |
func main() { | |
var a [5]int | |
fmt.Println("emp:", a) | |
a[4] = 100 |
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 flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/', methods=['GET', 'POST']) | |
def get_data(): | |
print(request.data) | |
return 'This is working!' |
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
<Plugin "write_http"> | |
<Node "example"> | |
URL "http://127.0.0.1:5000"; | |
Format JSON | |
</Node> | |
</Plugin> |
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
LoadPlugin logfile | |
<Plugin logfile> | |
LogLevel "info" | |
File "/root/sandbox/collectd.log" | |
PrintSeverity true | |
</Plugin> |
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
Hostname "localhost" | |
FQDNLookup true | |
BaseDir "/var/lib/collectd" | |
PluginDir "/usr/lib/collectd" | |
#TypesDB "/usr/share/collectd/types.db" "/etc/collectd/my_types.db" | |
AutoLoadPlugin false | |
CollectInternalStats 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
def add(x, y): | |
return x + y | |
def subtract(x, y): | |
return x - y | |
def multiply(x, y): | |
return x * y | |
def divide(x, y): |
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 add(x, y): | |
return x + y | |
def subtract(x, y): | |
return x - y | |
def multiply(x, y): | |
return x * y | |
def divide(x, y): |
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 pyowm | |
owm = pyowm.OWM('<api_key>') # TODO: Replace <api_key> with your API key | |
boston = owm.weather_at_place('Boston, US') | |
weather = boston.get_weather() | |
print(weather.get_sunrise_time(timeformat='iso')) # Prints time in GMT timezone | |
print(weather.get_sunset_time(timeformat='iso')) # Prints time in GMT timezone |
NewerOlder