This file contains hidden or 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
| -- Renames all direcories in the working directory by stripping a prefix | |
| -- Leaves those who dont match the prefix unchanged. | |
| import System.Directory | |
| import Data.List | |
| import System.Environment | |
| import Control.Monad.Extra | |
| main = getArgs >>= \[prefix] -> | |
| listDirectory "." >>= filterM doesDirectoryExist >>= mapM_ (maybe (return()) (renameDirectory <$> (prefix++) <*> id) . stripPrefix prefix) |
This file contains hidden or 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
| <html> | |
| <head> | |
| <script src="main.js" type="text/javascript" charset="utf-8"></script> | |
| <script type="text/javascript"> | |
| function reset_geschlecht () { | |
| var frau_input = document.getElementById("frau-input"); | |
| var mann_input = document.getElementById("mann-input"); | |
| frau_input.labels[0].style.color = "black"; | |
| mann_input.labels[0].style.color = "black"; |
This file contains hidden or 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 pathlib | |
| import sys | |
| import exifread | |
| from datetime import datetime | |
| from itertools import count | |
| image_exts = [ | |
| ".jpg", |
This file contains hidden or 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 = "" |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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" |