Skip to content

Instantly share code, notes, and snippets.

View JanneSalokoski's full-sized avatar

Janne Salokoski JanneSalokoski

View GitHub Profile
#!/usr/bin/env python
import sys
import math
debug = False # Whether debug output should be printed
def get_input():
"""Parse for user given numbers from arguments,
if none are found, prompt user for numbers."""
class Circle
{
constructor(radius)
{
this.radius = radius;
Circle.circles++; // Increment the
// amount of circles created.
}
// Circle.draw - draw given circle
$ ./httpclient.py 127.0.0.1 8000 test.json
--4d6735125320465f8a8d770448b68197
Content-Disposition: form-data; name="test.json"; filename="test.json"
{
"test": {
"lol": "uik",
"uik": "lol"
},
"uikz": "asdf"
1 4 3.1415925771662829282457329860278605337953194975853
2 2.6666666666666667406815349750104360282421112060547 3.1415926535897928514526333820811032637720927596092
3 3.4666666666666667850904559600166976451873779296875 3.1415926535897934909150747140316184413677547127008
4 2.8952380952380953882396852350211702287197113037109 3.1415926535897934909150747140316184413677547127008
5 3.3396825396825398080125069100176915526390075683594 3.1415926535897934909150747140316184413677547127008
6 2.9760461760461761615559339588799048215150833129883 3.1415926535897934909150747140316184413677547127008
7 3.2837384837384838709439804915746208280324935913086 3.1415926535897934909150747140316184413677547127008
8 3.0170718170718172079780572403251426294445991516113 3.1415926535897934909150747140316184413677547127008
9 3.2523659347188760282421071678982116281986236572266 3.1415926535897934909150747140316184413677547127008
10 3.0418396189294023557181390060577541589736938476562 3.1415926535897934909150747140316184413677547127008
#!/usr/bin/env python
import sys
import math
def simple(n):
series = []
try:
for i in range(0, n):
#!/usr/bin/env python
import sys
import math
def simple(n):
a = 0
for i in range(0, n):
a = a + (-1)**i * 1/(2*i+1)
#!/usr/bin/python
import random
import re
words = {
"pyytää, rukoilla": ["be", "ber", "bad", "bett"],
"sitoa": ["binda", "binder", "band", "bundit"],
"purra": ["bita", "biter", "bet", "bitit"],
"tarjota": ["bjuda", "bjuder", "bjöd", "bjudit"],
#!/usr/bin/python
import random
import time
import sys
def getNewQuestion(x, y):
print("{:^4} + {:^4} = ".format(x, y), end="")
try:
result = input()
local debug = false
local new_temperature = 0
sim.ambientAirTemp(20)
-- Test Window
local testWindow = Window:new(-1, -1, 150, 55)
local currentY = 10
# This is a list of bash commands I've found useful, but hard to remember.
# Get the temperature of the graphics card.
# Note: Only works for ATI/AMD cards.
sensors | grep radeon -A 2 | grep temp | sed 's:[^+]*\(\S*\).*$:\1:'
# Show the progress of a dd process.
dd --status=progress
# or
watch -n 10 kill -USR1 $(pgrep -l '^dd$' | sed 's: dd::')