Skip to content

Instantly share code, notes, and snippets.

View gamikun's full-sized avatar
🐷

Gamaliel Espinoza M. gamikun

🐷
View GitHub Profile
@gamikun
gamikun / buscamina.vb
Created May 3, 2017 00:40
Buscaminas
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6615
ClientLeft = 60
ClientTop = 345
ClientWidth = 9375
LinkTopic = "Form1"
ScaleHeight = 441
ScaleMode = 3 'Pixel
@gamikun
gamikun / bitpack.php
Created February 25, 2017 21:20
Boolean bitpacking for PHP
<?php
/**
* Given an array of numbers (of 24 bits/hours),
* where each bit of the number is equal to 1 hour,
* validates if the corresponding hour and day is on.
*
* @param $days Array of ~24 bits numbers.
* @param $day Number from 0 to 7
* @param $hour 0 to 23
@gamikun
gamikun / fareEstimator.py
Created June 29, 2016 18:20
CodeFights.UberBot.fareEstimator
def fareEstimator(ride_time, ride_distance, cost_per_minute, cost_per_mile):
estimations = []
for i, rtime in enumerate(ride_time):
rdist = ride_distance[i]
permin = cost_per_minute[i]
permile = cost_per_mile[i]
est = (rtime * permin) + (permile * rdist)
estimations.append(est)
return estimations
# CodeFights perfectCity
def perfectCity(departure, destination):
import math
sx, sy = departure
tx, ty = destination
distances = []
for i in [math.floor, math.ceil]:
x = sx
while (true) {
console.log("je");
}
<!DOCTYPE html>
<html>
<head>
<title>Mi fondo se mueve!</title>
<script type="text/javascript">
window.onload = function() {
document.onmousemove = function(e) {
var x = -(e.clientX/10);
var y = -(e.clientY/10);
this.body.style.backgroundPosition = x + 'px ' + y + 'px';
from __future__ import print_function
import sys
import math
import time
db = []
with open("./lonlat", 'rb') as fi:
for l in fi:
@gamikun
gamikun / RandomWebserviceMD5.py
Last active August 29, 2015 14:15
Random MD5 service in Python
from binascii import hexlify
from os import urandom
from wsgiref.simple_server import make_server
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return [hexlify(urandom(16))]
make_server('', 8000, app).serve_forever()
@gamikun
gamikun / curl.php
Last active June 29, 2016 18:23
Very simple HTTP Request with PHP cURL
<?php
$url = curl_init("http://teamlod.es/imga/imgur.php");
curl_setopt($url, CURLOPT_RETURNTRANSFER, 1);
echo curl_exec($url)
@gamikun
gamikun / MinecraftNBTParser.py
Last active August 29, 2015 14:10
Simple Minecraft NBT parser for Python
class NBTParser(object):
END = 0
BYTE = 1
COMPOUND = 10
SHORT = 2
INT = 3
LONG = 4
FLOAT = 5
DOUBLE = 6
BYTE_ARRAY = 7