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 python2 | |
# coding: utf-8 | |
COMMAND = 'fswebcam --save ~/Dropbox/images/unlock-{date}.jpeg' | |
import subprocess | |
from datetime import datetime | |
import gobject |
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 python3 | |
from math import sqrt, pi | |
def integrate(f, x, error_margin=0.0001, start_num_seg=10): | |
def p(num_seg): | |
width = x / num_seg | |
p = f(0) | |
p += sum(4*f(i*width) for i in range(1, num_seg, 2)) |
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
Title: Pyinstaller Kullanımı (Windows) | |
Date: 2010-07-01 12:49 | |
Category: Gezegen, Özgür Yazılım - Linux, Program Anlatımları, Programlama, Python | |
Tags: py2exe, pyinstaller, pyqt, python, windows | |
Bir önceki yazıda py2exe kullanımını anlatmıştım. Ancak o yazıya gelen | |
bir yorum sonrası, Pyinstaller'i keşfettim ve gerçekten de Py2Exe'den | |
daha başarılı bir program. En başta, oluşturulan dosyanın boyutu daha | |
küçük. Üstelik kullanımı daha kolay ve bir ekstra ayar yapmadan PyQt'yi | |
destekliyor. |
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
module Trie where | |
data Trie a = Node Char (Trie a) (Trie a) (Trie a) (Maybe a) | |
| Empty deriving (Show, Eq) | |
sanify :: Trie a -> Trie a | |
sanify (Node _ Empty Empty Empty Nothing) = Empty | |
sanify (Node _ Empty lo Empty Nothing) = lo | |
sanify (Node _ Empty Empty hi Nothing) = hi | |
sanify t = t |
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
### Keybase proof | |
I hereby claim: | |
* I am utdemir on github. | |
* I am utdemir (https://keybase.io/utdemir) on keybase. | |
* I have a public key whose fingerprint is AC38 11DF 709A 1F3B 4292 6199 C156 E0E6 84DA 5E04 | |
To claim this, I am signing this object: |
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
module Stats where | |
import Data.List | |
import Data.Maybe | |
import Data.Time.Clock | |
import Data.Time.Calendar | |
import Network.URL | |
import GHC.Exts |
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
-- Stolen from http://www.haskell.org/haskellwiki/Testing_primality | |
primes :: [Integer] | |
primes = 2: 3: sieve (tail primes) [5,7..] | |
where | |
sieve (p:ps) xs = h ++ sieve ps [x | x <- t, x `rem` p /= 0] | |
where (h,~(_:t)) = span (< p*p) xs | |
isPrime :: Integer -> Bool | |
isPrime n = n > 1 && all (\ p -> n `rem` p /= 0) (takeWhile (\ p -> p*p < n) primes) |
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 System.Environment | |
import Math.NumberTheory.Primes.Sieve (primes) | |
import Math.NumberTheory.Primes.Testing (isPrime) | |
-- Converts 42d -> 101010d | |
binread :: Integer -> Integer | |
binread 0 = 0 | |
binread n = let (q, r) = n `divMod` 2 | |
in r + 10 * binread q |
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 System.Environment | |
import Control.Parallel.Strategies | |
import Math.NumberTheory.Primes.Sieve (primes) | |
import Math.NumberTheory.Primes.Testing (isPrime) | |
-- Converts 42d -> 101010d | |
binread :: Integer -> Integer | |
binread 0 = 0 | |
binread n = let (q, r) = n `divMod` 2 |
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 System.Environment | |
import Control.Parallel.Strategies | |
import Math.NumberTheory.Primes.Sieve (primes) | |
import Math.NumberTheory.Primes.Testing (isPrime) | |
-- Converts 42d -> 101010d | |
binread :: Integer -> Integer | |
binread 0 = 0 | |
binread n = let (q, r) = n `divMod` 2 |
OlderNewer