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
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE UnicodeSyntax #-} | |
import Control.Concurrent (threadDelay) | |
import Control.Monad (forever) | |
import Filesystem | |
import Filesystem.Path.CurrentOS | |
import Prelude hiding (FilePath) | |
import Prelude.Unicode |
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
{-# LANGUAGE UnicodeSyntax #-} | |
module StyleAll where | |
import Control.Monad | |
import Control.Monad.Unicode | |
import Data.Bool | |
import Prelude.Unicode | |
import System.Directory | |
import System.Environment |
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 | |
import re | |
from urllib.request import urlopen | |
import json | |
from itertools import chain | |
linkregex = re.compile(r'(https?://([\w\.-]*)?\.sz-online\.de)(/[\w/-]*\.html)') |
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 Network.Browser | |
main = | |
browse $ do | |
setAuthorityGen (\_ _ -> return $ Just ("username", "password")) | |
request $ getRequest "http://github.com" |
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 string import Template | |
import sys | |
import collections | |
import pathlib | |
def from_yaml(file): | |
import yaml | |
return yaml.load(file) |
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 Lychrel where | |
import System.Environment | |
import Data.Foldable | |
iterateUntil f v = | |
maybe | |
[] | |
((:) <$> id <*> iterateUntil f) |
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
{- read a file, filter out all words in quotes that are at the beginning of a line, and print the resulting words. Using functions from Prelude only -} | |
main = readFile "input.txt" >>= mapM (putStrLn . (('\"' :) . (++ "\"") . takeWhile (/= '\"') . tail)) . filter ((== '\"') . head) . lines | |
{- here's another version, that's a bit more hacky in my opinion, but closer to the original (and shorter than the ruby code ;) -} | |
main=readFile"input.txt">>=mapM(putStrLn.takeWhile(/=' ')).filter((=='\"').head).lines |
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
-- User.signup = function(user) { | |
-- return new Promise(function(resolve, reject) { | |
-- User.validate(user).then(function() { | |
-- return Bcrypt.genSalt(10); | |
-- }).then(function(salt) { | |
-- return Bcrypt.hash(user.password, salt, null); | |
-- }).then(function(saltedHashedPassword) { | |
-- return User.insertIntoDatabase(user, saltedHashedPassword); | |
-- }).then(function(userRecord) { | |
-- resolve(userRecord); |
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 | |
""" | |
If you, like me, often have to send a bunch of very similer emails to a bunch of | |
people you may have got tired of copy pasting and resending as well. | |
This is my proposed solution: | |
This script reads a template file, using the simple python templating language | |
that substitutes vaules like $this with data from a dictionary. |
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 subprocess import check_call, CalledProcessError, STDOUT | |
import os | |
import json | |
import io | |
import sys | |
APP_DIR = "" |
OlderNewer