Skip to content

Instantly share code, notes, and snippets.

View flengyel's full-sized avatar
🎯
Focusing

F Lengyel flengyel

🎯
Focusing
  • The City University of New York
  • New York
  • 15:04 (UTC -04:00)
View GitHub Profile
var BuildTemplate = ' \
<h2 class="small-caps">build</h2> \
';
var BuildV = BaseV.extend({
className: 'btn-group-vertical',
initialize: function(o){
this.__player = o.player;
@flengyel
flengyel / hngen.py
Created November 29, 2013 04:01 — forked from grantslatton/hngen.py
import urllib2
import re
import sys
from collections import defaultdict
from random import random
"""
PLEASE DO NOT RUN THIS QUOTED CODE FOR THE SAKE OF daemonology's SERVER, IT IS
NOT MY SERVER AND I FEEL BAD FOR ABUSING IT. JUST GET THE RESULTS OF THE
CRAWL HERE: http://pastebin.com/raw.php?i=nqpsnTtW AND SAVE THEM TO "archive.txt"
@flengyel
flengyel / python_resources.md
Created November 14, 2013 03:11 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@flengyel
flengyel / pictures.markdown
Created August 30, 2012 03:49 — forked from sent-hil/pictures.markdown
River (getriver.com): Keep a programming journal.

One of my favorite past times is to look at the notebooks of famous scientists. Da Vinci's notebook is well known, but there plenty others. Worshipping Da Vinci like no other, I bought a Think/Create/Record journal, used it mostly to keep jot down random thoughts and take notes. This was great in the beginning, but the conformity of lines drove me nuts. Only moleskines made blank notebooks, so I had to buy one.

At the same time I started a freelance project. The project itself is irrelevant, but suffice to say it was very complex and spanned several months. It seemed like a perfect opportunity to use the moleskine. Looking back, all my entries fell under few categories:

  • Todo
  • Question
  • Thought
  • Bug
  • Feature
;; flengyel's solution to Game of Life
;; https://4clojure.com/problem/94
(fn [board]
(letfn [ (remap [board]
(->> (for [v board]
(->> (map (fn [c] (if (= (str c) " ") 0 1)) v)
(apply vector)))
(apply vector)))
(unmap [matrix]
;; flengyel's solution to Sum Some Set Subsets
;; https://4clojure.com/problem/131
(fn [s & ss]
(letfn [
(subsets [s]
(if (empty? s)
#{#{}}
(let [x (set (list (first s)))
dx (clojure.set/difference s x)
;; flengyel's solution to Power Set
;; https://4clojure.com/problem/85
(fn power [s]
(if (empty? s)
#{#{}}
(let [x (set (list (first s)))
dx (clojure.set/difference s x)
t (power dx)]
(clojure.set/union t
;; flengyel's solution to Juxtaposition
;; https://4clojure.com/problem/59
(fn [x & xs]
(fn [y & ys] (vec (for [f (vec (concat [x] xs))] (apply f (vec (concat [y] ys)))))))
;; flengyel's solution to Sequs Horribilis
;; https://4clojure.com/problem/112
(fn [n s]
(letfn [(sequs [n s]
(loop [acc 0 v [] s s]
(if (or (empty? s) (< n acc))
[acc v]
(let [elt (first s)]
(if (vector? elt)
;; flengyel's solution to Longest Increasing Sub-Seq
;; https://4clojure.com/problem/53
(fn [v]
(let [[maybe n cur _]
(let [v1 (first v)]
(reduce
(fn
[[longest maxlen current prv] elt]
(if (>= prv elt)