Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View alejomongua's full-sized avatar

Alejandro Mongua alejomongua

  • Bogotá, Colombia
View GitHub Profile
@alejomongua
alejomongua / game.js
Last active March 16, 2022 00:44
Class for 2048 game in javascript
class Game {
constructor() {
this.status = [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]
];
this.game_over = false;
this.random_spawn();
@alejomongua
alejomongua / test_loop.py
Last active August 29, 2015 14:01
Test para el loop
import serial, sys
import Adafruit_BBIO.UART as UART
UART.setup("UART1")
ser = serial.Serial(port = "/dev/ttyO1", baudrate=1000000, timeout=1, parity='O', stopbits=2)
send = 'hola mundo hola mundo'
def printHexS(myString):
sys.stdout.write('\r')
for x in myString:
sys.stdout.write('{0:#04X} '.format(ord(x)))
sys.stdout.flush()
@alejomongua
alejomongua / gen_password
Created April 25, 2014 19:41
My own password generator. It depends on xclip and ruby. Works on linux
#!/usr/bin/env ruby
CHAR_MAP = [('a'..'z'), ('A'..'Z'), ('#'..'9')].map { |i| i.to_a }.flatten
pass = (0...10).map { CHAR_MAP[rand(CHAR_MAP.length)] }.join
exec "echo #{pass} | xclip -sel clip && echo 'Copied to clipboard'"
@alejomongua
alejomongua / gist:7048177
Created October 18, 2013 20:57
Get MAC address python
import commands
def getmac(iface):
mac = commands.getoutput("ifconfig " + iface + "| grep HWaddr | awk '{ print $5 }'")
if len(mac)==17:
return mac
getmac('eth0')
@alejomongua
alejomongua / package.json
Created September 22, 2013 21:40
Test saving a model with sequelize
{
"name": "test",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node test.js"
},
"dependencies": {
"sequielize":"https://dl.dropboxusercontent.com/u/18947902/sequelize-github-master-201309221617.tar.gz",
"pg": "~0.10.2",