Skip to content

Instantly share code, notes, and snippets.

View douglasmiranda's full-sized avatar
👽

Douglas Miranda douglasmiranda

👽
  • Earth, Brazil
View GitHub Profile
@hullen
hullen / mobileCheck.js
Last active May 23, 2021 12:49
Detects mobile devices: phones, tablets. mobileCheck is a lightweight Javascript utils for detecting mobile devices and tablets. Its using User Agent string. Usage: if ( mobileCheck.smarphone ) { // Code }
var mobileCheck = {
ios: (function(){
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
}()),
android: (function(){
return navigator.userAgent.match(/Android/i);
}()),
blackBerry: (function(){
return navigator.userAgent.match(/BB10|Tablet|Mobile/i);
}()),
@audreyfeldroy
audreyfeldroy / pypi-release-checklist.md
Last active February 23, 2023 15:03
My PyPI Release Checklist
  • Update HISTORY.md
  • Commit the changes:
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
@securitytube
securitytube / SSHDictionaryAttack.py
Created April 4, 2013 06:24
SSH Dictionary Attack using Usernames and Password Lists
#!/usr/bin/env python
"""
Author: Vivek Ramachandran
Website: http://SecurityTube.net
Online Infosec Training: http://SecurityTube-Training.com
"""
import paramiko
@iamatypeofwalrus
iamatypeofwalrus / roll_ipython_in_aws.md
Last active January 22, 2024 11:18
Create an iPython HTML Notebook on Amazon's AWS Free Tier from scratch.

What

Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.

What are we using? What do you need?

  • An active AWS account. First time sign-ups are eligible for the free tier for a year
  • One Micro Tier EC2 Instance
  • With AWS we will use the stock Ubuntu Server AMI and customize it.
  • Anaconda for Python.
  • Coffee/Beer/Time
import sys
import collections
import gridfs
import io
import psycopg2
import pymongo
import random
import time
# For fairness use the same chunk size - 512k.
@rh0dium
rh0dium / base.py
Created February 10, 2013 23:19
Another..
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': "[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s",
'datefmt': "%d/%b/%Y %H:%M:%S"
},
},
'handlers': {
class ColorizingStreamHandler(logging.StreamHandler):
"""
A stream handler which supports colorizing of console streams
under Windows, Linux and Mac OS X.
:param strm: The stream to colorize - typically ``sys.stdout``
or ``sys.stderr``.
"""
# color names to indices
@fabiocerqueira
fabiocerqueira / example_descriptors.py
Created October 11, 2012 02:17
Exemplo de uso de descriptors em Python
class Field(object):
def __init__(self, default=None):
self.val = default
def __get__(self, obj, objtype):
if obj is None:
return self.__class__
else:
return self.val
@marcelcaraciolo
marcelcaraciolo / friends_recommender.py
Created October 10, 2012 18:31
Twitter Friends Recommender
#-*-coding: utf-8 -*-
'''
This module represents the recommender system for recommending
new friends based on 'mutual friends'.
'''
__author__ = 'Marcel Caraciolo <caraciol@gmail.com>'
from django.views.generic import ListView
from django.views.generic.edit import FormMixin
from django.db.models import Q
class SearchView(FormMixin, ListView):
template_name_suffix = '_search'
filter_operator = 'contains'
allow_or_operator = False
def get_filter_operator(self):