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
a = bin(999999999)[2:] | |
temp = [] | |
for i, v in enumerate(a): | |
if v == '1': | |
temp.append(len(a) - i) | |
print a | |
print temp | |
# 111011100110101100100111111111 | |
# [30, 29, 28, 26, 25, 24, 21, 20, 18, 16, 15, 12, 9, 8, 7, 6, 5, 4, 3, 2, 1] |
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
require "irc" | |
local lanes = require "lanes".configure() | |
local linda = lanes.linda() | |
local re = require "re" | |
local sleep = require "socket".sleep | |
local id = 0 | |
local queued_requests = {} |
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
ORG $400 | |
LEA STRING,A1 a1 points to mem to be printed | |
MOVE.B #14,D0 d0 holds our trap code | |
TRAP #15 print from a1 | |
LEA SPACE,A1 point a1 to space | |
TRAP #15 print space | |
MOVEA.L #DATA,A0 point a0 at our data list | |
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
number = 1 | |
#creates the nth triangle number | |
def triangle(number): | |
return (number * (number + 1)) / 2 | |
#finds factors for triangle numbers | |
def factors(number): | |
num_factors = 0 | |
for i in xrange(1, int(number**0.5) + 1): |
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
data = """ | |
73167176531330624919225119674426574742355349194934 | |
96983520312774506326239578318016984801869478851843 | |
85861560789112949495459501737958331952853208805511 | |
12540698747158523863050715693290963295227443043557 | |
66896648950445244523161731856403098711121722383113 | |
62229893423380308135336276614282806444486645238749 | |
30358907296290491560440772390713810515859307960866 | |
70172427121883998797908792274921901699720888093776 | |
65727333001053367881220235421809751254540594752243 |
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 tetra(x, y): | |
c = x ** x | |
print c | |
>>> tetra(3, 3) | |
27 | |
>>> tetra(2, 5) | |
4 | |
>>> tetra(2, 3) | |
4 |
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 maildb | |
import email | |
import time | |
import datetime | |
def genarate(STARTDATE, RECIPIENTS, DAYCOUNT, MESSAGE): | |
last_date = STARTDATE | |
mail = email.message_from_string(MESSAGE) | |
msg_lib = [] | |
i = 0 |
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 generate(startdate, recipients, daycount, message): | |
... last_date = startdate | |
... mail = email.message_from_string(message) | |
... msg_lib = [] | |
... for i in range(0, daycount): | |
... for recep in range(len(recipients)): | |
... mail['date'] = email.utils.formatdate(time.mktime(last_date.utctimetuple())) | |
... msg_lib.append(mail) | |
... last_date = last_date + datetime.timedelta(days=1) | |
... return msg_lib |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
typedef struct | |
{ unsigned long length | |
; char *data | |
; | |
} String; |
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
$.ajax({ | |
type: "POST", | |
url: "meta-parse.php", | |
data: $('input.#url').serialize(), | |
success: function(data) { | |
var json = $.parseJSON(data); | |
var images = json.images.split(','); | |
$('#url_preview').html("<div id='message'></div>"); | |
$('#url_preview').toggle(); | |
$('#add_process_board_picker').toggle(); |