Skip to content

Instantly share code, notes, and snippets.

View andreif's full-sized avatar
👾
invading spaces

Andrei Fokau andreif

👾
invading spaces
View GitHub Profile
package com.willowtreeapps.demo;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_heroku import Heroku
from flask_sslify import SSLify
from raven.contrib.flask import Sentry
from flask.ext.celery import Celery
import time
import json
import ujson
import cjson
import yajl
import simplejson
DATA = [{
'words': """
Lorem ipsum dolor sit amet, consectetur adipiscing
@andreif
andreif / gDNS.py
Created July 23, 2013 19:23 — forked from gleicon/gDNS.py
# dns server using dnslib and gevent
# based on https://bitbucket.org/paulc/dnslib/src/80d85555aae4/src/server/gevent_server.py
# set the key as
# set IP:name ip_addr
# set TXT:name txtfield
# fallback on gevent's dns resolver
# gleicon 2011
import gevent
@andreif
andreif / dnsd.rb
Created July 23, 2013 09:13 — forked from peterc/dnsd.rb
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL
# A naive dns server with a Redis backend
# Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1)
# Tip: Use Redis's ttl functions to have temporary names
# Currently only does A records, feel free to fix that
#
# Licensed under the PSF License
# Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/
# Author: @Kaerast <alice@kaerast.info>
import socket
@andreif
andreif / twisted.names.py
Last active December 20, 2015 01:19 — forked from johnboxall/dns.py
#!/usr/bin/env python
# http://twistedmatrix.com/trac/ticket/5421
from twisted.names import client
from twisted.internet import reactor
import sys
r = client.Resolver(servers=[('128.193.0.10',53)])
def test_soa(a):
<!-- Drop this in ~/Library/Preferences/PyCharm20/tools -->
<!-- make sure you set the path to flake8 executable for your machine in the COMMAND option -->
<?xml version="1.0" encoding="UTF-8"?>
<toolSet name="Flake8">
<tool name="Flake8 File" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="false" disabled="false" useConsole="true" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="/usr/local/share/python/flake8" />
<option name="PARAMETERS" value="--max-line-length=120 --ignore=E301,E302,E261,E262,W404 $FileDir$/$FileName$" />
<option name="WORKING_DIRECTORY" value="$FileDir$" />
@andreif
andreif / fft.rb
Created January 11, 2013 22:01 — forked from mro/fft.rb
#!/usr/bin/env ruby
require 'complex'
class Array
# DFT and inverse.
#
# Algorithm from
# 'Meyberg, Vachenauer: Hoehere Mathematik II, Springer Berlin, 1991, page 332'
#
# See http://blog.mro.name/2011/04/simple-ruby-fast-fourier-transform/
@andreif
andreif / codegen.py
Created November 13, 2012 15:45 — forked from jonovik/codegen.py
A module to "unparse" a Python AST tree.
# -*- coding: utf-8 -*-
"""
codegen
~~~~~~~
Extension to ast that allow ast -> python code generation.
:copyright: Copyright 2008 by Armin Ronacher.
:license: BSD.
"""