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
| {-| | |
| Haskell port of F# http://fssnip.net/si | |
| -} | |
| import Control.Applicative ((<$>), (<*>)) | |
| import System.Random (randomIO, randomRIO) | |
| import qualified Data.ByteString.Lazy as B | |
| import Data.Word8 | |
| data Expr = | |
| VariableX |
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
| {-| | |
| Haskell port of OCaml http://pastebin.com/a66MDZkP | |
| -} | |
| import qualified Data.ByteString.Lazy as B | |
| import Data.Word8 | |
| type Point = (Double, Double) | |
| type Rgb = (Double, Double, Double) | |
| tga :: (Point -> Rgb) -> Int -> Int -> String -> IO () |
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
| + [pyenv:22] enable -f /usr/local/bin/../libexec/pyenv-realpath.dylib realpath | |
| + [pyenv:29] '[' -z '' ']' | |
| ++ [pyenv:31] type -p greadlink readlink | |
| ++ [pyenv:31] head -1 | |
| + [pyenv:31] READLINK=/usr/bin/readlink | |
| + [pyenv:32] '[' -n /usr/bin/readlink ']' | |
| + [pyenv:57] '[' -z /Users/giacomo/.pyenv ']' | |
| + [pyenv:60] PYENV_ROOT=/Users/giacomo/.pyenv | |
| + [pyenv:62] export PYENV_ROOT | |
| + [pyenv:65] '[' -z '' ']' |
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
| # file URL: https://raw.githubusercontent.com/gsscoder/test-data/master/language-codes-3b2.csv | |
| buf = '' | |
| with open('language-codes-3b2.csv') as csv: | |
| data = csv.readlines() | |
| for d in data[1:]: | |
| langs = d.split(',') | |
| buf += f'{langs[0].upper()}|{langs[1].upper()}|' | |
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
| [ | |
| "Liam", | |
| "Noah", | |
| "William", | |
| "James", | |
| "Logan", | |
| "Benjamin", | |
| "Mason", | |
| "Elijah", | |
| "Oliver", |
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
| """ | |
| scrap-fb.py: | |
| Demonstrates facebook_snooper module (https://github.com/gsscoder/facebook-snooper). | |
| Install requirements: | |
| $ wget https://raw.githubusercontent.com/gsscoder/facebook-snooper/master/facebook_snooper.py | |
| $ wget https://raw.githubusercontent.com/gsscoder/facebook-snooper/master/requirements.txt | |
| $ python3 -m pip install -r requirements.txt | |
| Run: | |
| $ python3 scrap-fb.py [email protected] your_password | |
| Note: |
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
| # file URL: https://raw.githubusercontent.com/gsscoder/test-data/master/largest-cities.csv | |
| import csv | |
| import re | |
| cities = [] | |
| with open('largest-cities.csv') as f: | |
| reader = csv.DictReader(f, delimiter=',') | |
| for row in reader: |
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
| def supports_color(): | |
| # Ripped from: https://github.com/django/django/blob/master/django/core/management/color.py#L12 | |
| plat = sys.platform | |
| supported_platform = plat != 'Pocket PC' and (plat != 'win32' or 'ANSICON' in os.environ) | |
| # isatty is not always implemented, #6223. | |
| is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() | |
| return supported_platform and is_a_tty |
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
| # common aliases | |
| alias ll='ls -lha' | |
| alias la='ls -A' | |
| alias l='ls -CF' | |
| # grep options | |
| export GREP_OPTIONS="--color=always" | |
| export GREP_COLOR="1;35;40" | |
| # editor |
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
| # jsonify('{ hello: "json", hello_again: { from: ["java", "script"]}}') | |
| # '{ "hello": "json", "hello_again": { "from": ["java", "script"]}}' | |
| # note: before calling better use https://github.com/beautify-web/js-beautify | |
| def jsonify(js_dict_code): | |
| json_string = js_dict_code | |
| matches = re.findall(r'(?<![\S"])([^"\s{}\[\],]+:)(?![\S"])', js_dict_code) | |
| if matches: | |
| for unquoted in matches: |