Skip to content

Instantly share code, notes, and snippets.

View jonathanwork's full-sized avatar

Jonathan Lopez jonathanwork

View GitHub Profile
@jonathanwork
jonathanwork / mongodbRecords.js
Created January 3, 2017 06:38
getting the records and the content of a collection
//JUST to show record within mongodb
var collections = db.getCollectionNames();
print('Collections inside the db:');
for(var i = 0; i < collections.length; i++){
var name = collections[i];
if(name.substr(0, 6) != 'system')
print(name + ' - ' + db[name].count() + ' records');
}
@jonathanwork
jonathanwork / power_function.sass
Created March 20, 2017 09:29
power function in sass
@function pow($number, $exponent)
@if (round($exponent) != $exponent)
@return exp($exponent * ln($number))
$value: 1
@if $exponent > 0
@for $i from 1 through $exponent
$value: $value * $number
@jonathanwork
jonathanwork / geo.js
Created April 9, 2017 22:08
geolocation in javascript ;)
navigator
.geolocation
.getCurrentPosition(position=> {
var lat = position.coords['latitude'];
var lng = position.coords['longitude'];
console.log(lat, lng);
})
@jonathanwork
jonathanwork / geo.js
Last active April 9, 2017 22:10
geolocation in javascript ;)
navigator
.geolocation
.getCurrentPosition(position=> {
var lat = position.coords['latitude'];
var lng = position.coords['longitude'];
console.log(`your current location is ${lat}, ${lng}`);
})
@jonathanwork
jonathanwork / geome.js
Created April 28, 2017 02:13
get clients ip geolocation.
$(document).ready(function () {
$.getJSON("https://jsonip.com/?callback=?", function (data) {
console.log(data);
alert(data.ip);
});
});
@jonathanwork
jonathanwork / chatServer.js
Created May 2, 2017 07:04 — forked from creationix/chatServer.js
A simple TCP based chat server written in node.js
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
<video loop autoplay>
<source src="LAEPANIMACION/slidenuevo.mp4" type="video/mp4">
</video>
@jonathanwork
jonathanwork / find_IP.js
Created May 4, 2017 04:43
getting ip address of the current page
$.getJSON( "//freegeoip.net/json/" + window.location.host + "?callback=?", function(data) {
console.warn('Fetching JSON data...');
// Log output to console
console.info(JSON.stringify(data, null, 2));
});
@jonathanwork
jonathanwork / kssh
Created May 4, 2017 05:36 — forked from arcticlinux/kssh
Port Knocking SSH wrapper
#!/bin/bash
# Author: Michael Best <mbest@arcticlinux.com>
# Designed to work with the Shorewall Port Knocking Implementation
# http://shorewall.net/PortKnocking.html
COMMAND="ssh"
PORT=1600
TIMEOUT=2
@jonathanwork
jonathanwork / Dockerfile
Created May 22, 2017 22:40 — forked from rosstimson/Dockerfile
Easily get ffmpeg on Fedora with support for all the things.
# Dockerfile for ffmpeg with pretty much support for everything as per:
# https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
# includes codecs with weird licensing like MP3 and AAC.
#
FROM fedora
MAINTAINER Ross Timson <ross@rosstimson.com>
# Install build requirements.
RUN dnf install -y autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel