print [ x*x for x in xrange(1000) if list(str(x*x)) == list(reversed(str(x*x)))]
$ python foo.py
[0, 1, 4, 9, 121, 484, 676, 10201, 12321, 14641, 40804, 44944, 69696, 94249, 698896]
def words(): | |
with open('/usr/share/dict/words', 'r') as f: | |
return (x.strip().upper() for x in f.readlines()) | |
MAPPING = {'A':'A', 'B':'B', 'C':'C', 'D':'D', | |
'E':'E', 'F':'F', 'O':'0', 'S':'5', 'I':'1'} | |
def main(): | |
is_hexword = lambda word: all(ch in MAPPING for ch in word) | |
for word in filter(is_hexword, words()): |
(defn fizzbuzz [] | |
(map #(cond (= 0 (mod % 15)) "wibblefish" (= 0 (mod % 3)) "wibble" (= 0 (mod % 5)) "fish" :else %) (range 1 101))) |
import random | |
import sys | |
def pick(switch): | |
doors = ['car', 'goat', 'goat'] | |
random.shuffle(doors) | |
choices = zip(range(len(doors)), doors) | |
my_choice = random.choice(choices) | |
rest_choices = filter(lambda x: x!=my_choice, choices) |
#! /usr/bin/env python | |
import sys | |
import json | |
print json.dumps(json.loads(sys.stdin.read()), sort_keys=True, indent=4) |
<script type="text/javascript" src="https://catastrophy.freshbooksdev.com/external/embed/embed.js"></script> |
<div id="freshbooks-quoteme" class="container"></div> |
cd /root; | |
rm -f cacert.pem*; | |
wget http://curl.haxx.se/ca/cacert.pem; | |
chattr -i /usr/share/curl/curl-ca-bundle.crt; | |
chattr -i /usr/share/ssl/certs/ca-bundle.crt; | |
rm -f /usr/share/curl/curl-ca-bundle.crt; | |
rm -f /usr/share/ssl/certs/ca-bundle.crt; | |
cp -f cacert.pem /usr/share/curl/curl-ca-bundle.crt; | |
cp -f cacert.pem /usr/share/ssl/certs/ca-bundle.crt; | |
chmod 644 /usr/share/curl/curl-ca-bundle.crt; |
print [ x*x for x in xrange(1000) if list(str(x*x)) == list(reversed(str(x*x)))]
$ python foo.py
[0, 1, 4, 9, 121, 484, 676, 10201, 12321, 14641, 40804, 44944, 69696, 94249, 698896]
// Install dependencies with 'npm install' | |
// Run as 'node level00.js' | |
var express = require('express'), // Web framework | |
mu = require('mu2'), // Mustache.js templating | |
sqlite3 = require('sqlite3'); // SQLite (database) driver | |
// Look for templates in the current directory | |
mu.root = __dirname; |
<html> | |
<head> | |
<title>Secret Safe</title> | |
</head> | |
<body> | |
{{#namespace}} | |
<div style="border-width: 2px; border-style: outset; padding: 5px"> | |
Showing secrets for <strong>{{namespace}}</strong>: | |
<table> | |
<thead> |