Skip to content

Instantly share code, notes, and snippets.

View mutaku's full-sized avatar
🌌
Latent Layer 5

Matthew Martz mutaku

🌌
Latent Layer 5
View GitHub Profile
# conky configuration
#
# The list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
#
# For ideas about how to modify conky, please see:
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/
#
# For help with conky, please see:
@mutaku
mutaku / problem_a.py
Last active December 17, 2015 21:19
Ural Championship 2013 Problem Set
# Problem A. Graphics Settings
'''
Example input:
1
vsync 10
640 480 10000000
2
Off vsync
Resolution 320 240
'''
@mutaku
mutaku / problem_1.py
Created May 29, 2013 20:45
Project Euler Toiling
def multiples(max, div):
results = list()
for i in range(1, max):
if not all(map(lambda x: i % x, div)):
results.append(i)
return results
a = multiples(1000, [3, 5])
sum(a)
@mutaku
mutaku / grabdragndrop.py
Created May 23, 2013 18:26
Test handling multiple drag and drops to raw_input
def grabber():
s = raw_input("files: ")
delim = "C:\\"
files = [delim+x for x in s.split(delim) if x]
return files
@mutaku
mutaku / old_post_handler.py
Created May 16, 2013 18:55
Rip out old posts from wordpress XML export, convert to markdown, and put in a new database structure.
from django.core.files.uploadedfile import InMemoryUploadedFile
import cStringIO
import StringIO
from urllib2 import urlopen
from PIL import Image as PILImage
import re
import os
from xml.dom import minidom
from mutaku.blog.models import Post, Image
from mutaku.tools.extras import findext
@mutaku
mutaku / printer_jobs_strings.py
Last active December 17, 2015 09:09
Create a print job string for page range by supplying a total range of pages and an exclude list (such as graphical pages or ones simply not needed).
'''Create a print job string for page range by supplying
a total range of pages and an exclude list (such as graphical
pages or ones simply not needed).
Example:
In [1]: from printer_jobs_strings import make_print_string
In [2]: pages = range(0, 25)
In [3]: exclude = [3, 6, 7, 8, 15, 24]
In [4]: make_print_string(pages, exclude)
Out[5]: '0-2,4-5,9-14,16-23'
@mutaku
mutaku / checkurl.py
Created December 14, 2012 04:14
Check that a URL goes somewhere
from urllib2 import urlopen
URLfail = False
try:
code = urlopen(the_url).code
if code >= 400:
URLfail = True
except:
URLfail = True
Enter number of digits:
999 - symmetry
start 999999 - stop 100
xx
SsSs
floor : 1001 ceiling : 999
floor : 999 ceiling : 999
floor : 999 ceiling : 999
997799
999 , 999
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
/* Practicing examples from http://web.cse.msu.edu/~cse231/python2Cpp.html
and http://code.google.com/edu/languages/cpp/basics/getting-started.html */