This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NUMBER_DESkTOP="$(xdotool get_num_desktops)" | |
CURRENT="0" | |
echo "Press [CTRL+C] to stop.." | |
while : | |
do | |
xdotool set_desktop $CURRENT | |
#echo $CURRENT | |
CURRENT="$(expr $CURRENT + '1')" | |
if [ "$CURRENT" -gt $NUMBER_DESkTOP ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fecha=$(date +%Y%m%d_%H%M) | |
echo "ready to dump database" | |
mysqldump -u root database --ignore-table=logs > /tmp/dump-$fecha.sql | |
echo "comprimiendo" | |
pbzip2 /tmp/dump-$fecha.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def command = """cat /var/lib/jenkins/.ssh/id_rsa.pub"""// Create the String | |
def proc = command.execute() // Call *execute* on the string | |
proc.waitFor() // Wait for the command to finish | |
// Obtain status and output | |
println "return code: ${ proc.exitValue()}" | |
println "stderr: ${proc.err.text}" | |
println "stdout: ${proc.in.text}" // *out* from the external program is *in* for groovy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cardinalToRoman( int num){ | |
def TreeMap map = [1:"I", 5: "V", 10 : "X", 100 :"C"] | |
def getLatestKey = {int nu -> | |
def val = null | |
for (Map.Entry entry : map.descendingMap().entrySet()) { | |
def residuo = nu % entry.key; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package atoms.fat.media | |
import grails.converters.JSON | |
import org.joda.time.DateTime | |
class Media implements Serializable { | |
String url | |
String name | |
DateTime dateCreated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BootStrap { | |
def grailsApplication | |
grailsApplication.getArtefacts("Domain").each{dc-> | |
//here we register custom marshallers declared in domain classes | |
if(dc.hasProperty("marshaller")){ | |
dc.clazz.marshaller() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Mobile detect https://gist.github.com/dalethedeveloper/1503252 | |
if(req.http.User-Agent ~ ".*(Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune).*") | |
{ | |
set req.http.X-ua = "mobile"; | |
}else{ | |
set req.http.X-ua = "desktop"; | |
} | |
sub vcl_hash { | |
hash_data(req.http.X-ua + ":" + req.url ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CURL_FORMAT="URL: %{url_effective} ReturnCode: %{http_code}, TTFB: %{time_starttransfer}, Total time: %{time_total}, Download Size: %{size_download}" | |
FILE_URL=$1 | |
TOTAL_URL=$(wc -l < $FILE_URL | xargs) | |
COUNTER=1 | |
echo "1..$TOTAL_URL" | |
while read LINE | |
do | |
RES=$(curl -L -s -o /dev/null -w "$CURL_FORMAT" $LINE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
app.get('/*', function (req, res) { | |
console.log(req.originalUrl) | |
console.log(req.headers) | |
res.send('Hello World!'); | |
}); | |
app.listen(8090, function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var head = document.getElementsByTagName('head')[0]; | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = 'https://cdn.rawgit.com/Marak/faker.js/master/examples/browser/js/faker.js'; | |
script.onload = function() { | |
console.log("------>", faker, $("input[name='email']")) | |
window.randomData = function() { | |
// console.log("random data"); | |
faker.locale = 'es_MX'; |