Skip to content

Instantly share code, notes, and snippets.

View parzibyte's full-sized avatar
💻
Coding

Parzibyte parzibyte

💻
Coding
View GitHub Profile
@parzibyte
parzibyte / bf.php
Created July 7, 2016 17:40 — forked from apisurfer/bf.php
Simple brute force or string matching in PHP
<?php
/**
This is a simple proof of concept of a brute force algorithm for string matching with
given set of characters.
The way this works is that the algorithm counts from first to last possible combination of
given characters. Instead of counting(incrementing) in number base 10 we use
a new base which is derived from your set of possible characters (we count in symbols).
So if your characters list contains 27 characters the program actually counts in a 27 base
number system.
@parzibyte
parzibyte / distribucion-de-bernoulli.markdown
Created September 1, 2016 20:29
Distribución de Bernoulli
@parzibyte
parzibyte / controller.js
Created November 11, 2016 00:07 — forked from BobNisco/controller.js
onLongPress AngularJS Directive - Great for mobile!
// Somewhere in your controllers for this given example
// Example functions
$scope.itemOnLongPress = function(id) {
console.log('Long press');
}
$scope.itemOnTouchEnd = function(id) {
console.log('Touch end');
}
@parzibyte
parzibyte / SomeFragment.java
Created June 20, 2017 17:35 — forked from joshdholtz/SomeFragment.java
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);
@parzibyte
parzibyte / Acortar.py
Last active July 16, 2017 19:25
Acortar links usando Python y las apis de Coinurl, ShinkIn, Ouo y Linkbucks
import urllib.request, json
from urllib.parse import quote
from urllib.request import Request, urlopen
class Acortar:
def __init__(self, link):
self.link = link
self.link_seguro = quote( link.encode('UTF-8') )
def responder_texto_plano(self, cadena):
@parzibyte
parzibyte / sqlite3_interactivo.py
Created September 28, 2017 05:09
SQLite3 interactivo con Python
"""
Abre una base de datos de sqlite3 e interactúa con ella.
Útil para hacer pruebas
@author parzibyte
"""
import sqlite3
while True:
try:
"""
@parzibyte
parzibyte / relevador_bluetooth.ino
Created December 20, 2017 05:34
Encender y apagar relevador con Arduino y módulo Bluetooth. Con el relevador se puede encender algo como una bombilla, ventilador, etcétera. Y todo eso usando tu móvil o dispositivo con Bluetooth
#define PIN_RELEVADOR 2
void setup() {
Serial.begin(9600);
pinMode(PIN_RELEVADOR, OUTPUT);
}
void apagarRelevador() {
digitalWrite(PIN_RELEVADOR, LOW);
}
void encenderRelevador() {
digitalWrite(PIN_RELEVADOR, HIGH);
@parzibyte
parzibyte / palindromo.cs
Created December 21, 2017 02:01
Comprobar si una palabra es palíndroma (o como se escriba) en C#
using System;
namespace App
{
class Programa
{
static void Main(string[] args)
{
Console.WriteLine("Introduce una palabra y te diré si es palíndroma :) ");
String palabra = Console.ReadLine();
@parzibyte
parzibyte / palindromo.js
Created December 21, 2017 02:22
Comprobar si es palíndroma con recursión y JS
const esPalindroma = (cadena) =>{
if(cadena.length < 2) return true;
if(cadena.charAt(0) === cadena.charAt(cadena.length - 1)) return esPalindroma(cadena.substring(1, cadena.length - 1));
return false;
}
@parzibyte
parzibyte / hola_mundo.cs
Created December 21, 2017 17:32
Hola mundo en C#
using System;
namespace App
{
class Programa
{
static void Main(string[] args)
{
Console.WriteLine("Hola mundo");
}