Skip to content

Instantly share code, notes, and snippets.

View mishudark's full-sized avatar
:octocat:
Rocking

mishudark mishudark

:octocat:
Rocking
View GitHub Profile
@endolith
endolith / frequency_estimator.py
Last active July 15, 2024 21:25
Frequency estimation methods in Python
from __future__ import division
from numpy.fft import rfft
from numpy import argmax, mean, diff, log, nonzero
from scipy.signal import blackmanharris, correlate
from time import time
import sys
try:
import soundfile as sf
except ImportError:
from scikits.audiolab import flacread
@hubgit
hubgit / ElasticSearch.php
Created February 16, 2010 17:20
ElasticSearch class for PHP
<?php
// http://www.elasticsearch.com/docs/elasticsearch/rest_api/
class ElasticSearch {
public $index;
function __construct($server = 'http://localhost:9200'){
$this->server = $server;
}
import tornado.httpserver, tornado.ioloop, tornado.options, tornado.web, os.path
from tornado.options import define, options
define("port", default=8888, help="run on the given port", type=int)
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/", HomeHandler),
(r"/upload", UploadHandler)
@mathiasbynens
mathiasbynens / Slightly optimized version of the ‘Device Scale UI elements in iOS Mobile Safari’ script by 37signals
Created June 16, 2010 06:54 — forked from sstephenson/gist:439777
Slightly optimized version of the ‘Device Scale UI elements in iOS Mobile Safari’ script by 37signals
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
// Slightly optimized by Mathias Bynens <http://mathiasbynens.be/>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@fitorec
fitorec / intrusos.sh
Created October 10, 2010 09:19
Detecta a los usuarios conectados en la misma red de nuestra interfaz configurada(posibles intrusos).
#!/bin/bash
#Autor: fitorec <http://fitorec.wordpress.com/>
#Descripción: Detecta a los hosts conectados en nuestra red
#Requiere: nmap
#
#Atención: Lo único q requiere configurar es la interfaz en donde se desea escuchar
INTER='wlan0'
#Extraemos la configuración de la IP y mascara de red para usar con el nmap
CONFIG=`ip addr sh $INTER | grep -E -o "([0-9]+.){3}[0-9]+/[0-9]+" `
@mishudark
mishudark / deleteComments.sh
Created November 13, 2010 22:48
Elimina todos los comentarios (no usar con js comprimido tipo jquery.min.js
#!/bin/bash
#mishudark <mishudark@astrata.com.mx> <moonsadly@gmail.com>
#thanks ostermiller.org to amazing regex
#
# delete_comments.sh
#
# Copyright 2010 mishudark <mishudark@astrata.com.mx> <moonsadly@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@russellhaering
russellhaering / CloudkickAPI.java
Created November 14, 2010 01:46
Base API class
public class CloudkickAPI {
private static final String TAG = "CloudkickAPI";
private static String API_HOST = "api.cloudkick.com";
private static String API_VERSION = "1.0";
private final String key;
private final String secret;
private final HttpClient client;
private SharedPreferences prefs = null;
public CloudkickAPI(Context context) throws EmptyCredentialsException {
@mishudark
mishudark / print_block.php
Created December 24, 2010 03:33
Imprime un bloque desde el code
$bloque = (object) module_invoke('debate','block','view',6);
print theme('block',$bloque);
@mikeyk
mikeyk / redis_session_backend.py
Created April 8, 2011 18:01
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
@mishudark
mishudark / gist:938717
Created April 23, 2011 15:51
paginator compatible with pymongo and mongoengine
# pagination.py
class Paginator(object):
def __init__(self, query, per_page):
"""Initialize a paginator.
Arguments:
- query -- queryset from pymongo or mongoengine
- per_page -- number of items per page