Skip to content

Instantly share code, notes, and snippets.

@Xpktro
Xpktro / tweetcheck.coffee
Created October 24, 2012 19:23
Hubot Scripts
# Description:
# Echoes tweets from a given account with a certain checking time interval.
# Made originally for our corporate twitter account.
#
# Dependencies:
# None
#
# Configuration:
# None
#
@Xpktro
Xpktro / prefmask.py
Created November 23, 2012 06:02
Simple decimal subnet mask calculator.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Simple decimal subnet mask calculator.
#
# How to use:
# python prefmask.py <number>
# i.e.: python prefmask.py 17
#
#
@Xpktro
Xpktro / gist:6202473
Created August 10, 2013 22:30
How to be hired by Antonio Ognio pt. 1
>>> def a(n):
... l = []
... t = 1
... while len(l) != n:
... if t % n == 0: l.append(t)
... t += 1
... return l
...
>>> sum(a(7) + a(13))
1379
@Xpktro
Xpktro / gist:6222781
Created August 13, 2013 16:10
System-time synchronized timer in Python
from datetime import datetime
import time
while True:
t = datetime.utcnow()
print '%s:%s:%s' % (t.hour, t.minute, t.second)
sleeptime = 1 - (t.microsecond/1000000.0)
time.sleep(sleeptime)
@Xpktro
Xpktro / des.py
Last active May 26, 2022 11:34
des.py: A pure Python academic-only implementation of the DES cipher.
#coding:utf-8
"""des.py: A pure Python academic-only implementation of the DES cipher."""
__author__ = u'Moisés Cachay Tello'
__copyright__ = u'Copyright 2013, Moisés Cachay Tello'
import binascii
class BinString(str):
@Xpktro
Xpktro / greet.js
Created September 14, 2013 04:19
Programmer's day one-liner greeter.
(function(){var today = new Date(); var firstday = new Date(today.getFullYear(), 0, 1); if(Math.ceil((today-firstday)/86400000) === 256) console.log('Happy Programmers Day!');})();
@Xpktro
Xpktro / zen.sh
Created March 4, 2014 16:59
Github Zen consumer one-liner
python -c "import urllib; print urllib.urlopen('https://api.github.com/zen').read()"
@Xpktro
Xpktro / iptables.md
Last active August 29, 2015 13:57
Iptables spanish quickstart

Tutorial Iptables

Iptables es un comando que permite controlar el tráfico entrante, saliente y circulante del equipo, a través de una serie de reglas agrupadas en algo llamado tablas.

Para utilizar iptables se necesita estar en una consola de root, para iniciar sesión como root:

sudo su -
@Xpktro
Xpktro / capicua.py
Created April 16, 2014 00:01
Academic Excercises with Python (in spanish)
def capicua(numero):
numero = str(numero)
if numero == '' or len(numero) == 1:
return True
elif numero[0] == numero[-1]:
return capicua(numero[1:-1])
return False
print capicua(123321)
@Xpktro
Xpktro / acpe.cfdg
Created June 4, 2014 17:01
ArtCoders.pe Propuesta de Logo (Context-Free Art)
// ArtCoders.pe - Propuesta de Logo
// Variación recomendada: BQP
import i_pix.cfdg
import i_polygons.cfdg
startshape ccpe
CF::Background = [h -140.10 sat 0.8835 b -0.9448]
shape ccpe {
backg[x -6.65 4 1]
title[z 1]