Skip to content

Instantly share code, notes, and snippets.

@zyxar
zyxar / exercise.tour.go
Last active April 28, 2024 17:06
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@ktosiek
ktosiek / gist:f9a5c667a2cba74e8671
Created July 23, 2014 11:46
Fun with object()
In [15]: class A(object):
....: pass
....:
In [16]: a = A()
In [17]: setattr(s, s, 10)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-17-a4e7f439dc1b> in <module>()
@clchiou
clchiou / non_graceful_shutdown.py
Created March 19, 2015 04:32
Python ThreadPoolExecutor (non-)graceful shutdown
#!/usr/bin/env python3
import concurrent.futures.thread
import sys
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
def remove_file(path):
print('Removing file %s' % path)