Skip to content

Instantly share code, notes, and snippets.

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))
'''
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
@saulcosta
saulcosta / main.go
Created May 25, 2019 00:53
VS Code launch
package main
import "fmt"
func main() {
var a [5]int
fmt.Println("emp:", a)
a[4] = 100
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def get_data():
print(request.data)
return 'This is working!'
<Plugin "write_http">
<Node "example">
URL "http://127.0.0.1:5000";
Format JSON
</Node>
</Plugin>
LoadPlugin logfile
<Plugin logfile>
LogLevel "info"
File "/root/sandbox/collectd.log"
PrintSeverity true
</Plugin>
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
@saulcosta
saulcosta / main.py
Created May 6, 2019 16:14
Example calculator Python script.
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):
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):
@saulcosta
saulcosta / sunrise_sunset.py
Created February 6, 2019 03:25
PyOWM example 4
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