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
| # Create the body of the message (a plain-text and an HTML version). | |
| alt_text = "This report requires a mail reader which supports HTML" | |
| # Record the MIME types of both parts - text/plain and text/html. | |
| text_part = MIMEText(text, 'plain') | |
| html_part = MIMEText("".join(html_message), 'html') # Join the list containing the HTML read on STDIN |
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/python | |
| import smtplib | |
| import sys | |
| from email.mime.multipart import MIMEMultipart | |
| from email.mime.text import MIMEText | |
| # Grab the message on stdin |
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
| ;; based on core.logic 0.8-alpha1 | |
| (ns sudoku | |
| (:refer-clojure :exclude [==]) | |
| (:use clojure.core.logic)) | |
| (defn get-square [rows x y] | |
| (for [x (range x (+ x 3)) | |
| y (range y (+ y 3))] | |
| (get-in rows [x y]))) |
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
| <?php | |
| // Your PHP array | |
| $my_array = array('array' => array('a', 'b', 'c')); | |
| // Use json_encode to produce JSON | |
| $json_string = json_encode($my_array); | |
| // And let's see it! | |
| echo $json_string . "\n"; |
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
| <?php | |
| // The response from an API call.. | |
| $json_string = '{"array" : ["a", "b", "c"]}'; | |
| // Use json_decode to get a JSON object as a PHP associative array | |
| $json_obj = json_decode($json_string, true); | |
| // Iterate through it for fun | |
| foreach ($json_obj['array'] as $value) { |
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
| SUMPROG.ASM; | |
| %include "io.mac" | |
| .DATA | |
| abyte db 'A' | |
| .UDATA |
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
| (distinct (concat (range 3 1000 3) (range 5 1000 5))) |
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
| ; multiples of 3 under 1000 | |
| (range 3 1000 3) | |
| ; multiples of 5 under 1000 | |
| (range 5 1000 5) |
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 perl | |
| use warnings; | |
| use strict; | |
| use IO::Socket; | |
| my ($event_id, $dataroot) = @ARGV; | |
| my $directory = "$dataroot$event_id/"; | |
| my $remote_host = "localhost"; |