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
from sinesp_client import SinespClient | |
import sys | |
sc = SinespClient() | |
result = sc.search(sys.argv[1]) | |
print result |
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
require 'httpclient' | |
c = HTTPClient.new | |
a=0 | |
loop do | |
c.get_async("http://target.com") | |
p a | |
a += 1 | |
a = 0 if a == 10000 | |
end |
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
namespace :latest do | |
desc "rake 'latest:db' Get last state from the production database" | |
task db: :environment do | |
Rake::Task["db:drop"].execute | |
Rake::Task["db:create"].execute | |
system( "heroku pg:backups:capture --app <YOUR APP NAME>" ) | |
system( "curl -o latest.dump `heroku pg:backups public-url`" ) | |
system( "pg_restore --verbose --clean --no-acl --no-owner -d <YOUR DEVELOPMENT DATABSE NAME> latest.dump" ) | |
Rake::Task["db:migrate"].execute | |
end |
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 | |
FILES=/path/to/folder/* | |
for file in $FILES | |
do | |
sed -i "/my-complex-regexp-finder/a content-to-add" $file | |
done |
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
module Consolis | |
def parse_xls(opts={}) | |
opts[:file] = "output" unless opts[:file].present? | |
opts[:headers] = ["Important", "Data"] unless opts[:headers].present? | |
opts[:data] = [["foo","bar"]] unless opts[:data].present? | |
File.open(opts[:file]+".xls", "w+") do |f| | |
f.write("<meta charset='utf-8'><table border=yes width=100%>") | |
opts[:size] = 1 unless opts[:size].present? | |
f.write("<tr>") | |
opts[:headers].map do |header| |
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
while true; do | |
heroku logs --tail >> /tmp/<appname>.log | |
echo disconnect >> /tmp/<appname>.log | |
done |
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
module CommaSeparator | |
def separate params | |
params.split(/(?!\B\b('|")[^\"']*),(?![^\"']*('|")\B\b)/) | |
end | |
end |
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
//IMPLEMENT THIS PART BELOW | |
// Source: http://pixelscommander.com/en/javascript/javascript-file-download-ignore-content-type/ | |
window.downloadFile = function (sUrl) { | |
//iOS devices do not support downloading. We have to inform user about this. | |
if (/(iP)/g.test(navigator.userAgent)) { | |
//alert('Your device does not support files downloading. Please try again in desktop browser.'); | |
window.open(sUrl, '_blank'); | |
return false; |
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
// Future versions of Hyper may add additional config options, | |
// which will not automatically be merged into this file. | |
// See https://hyper.is#cfg for all currently supported options. | |
module.exports = { | |
config: { | |
// Choose either "stable" for receiving highly polished, | |
// or "canary" for less polished but more frequent updates | |
updateChannel: 'stable', |
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
$(document).on('turbolinks:before-cache', function(e) { | |
return $('.form-control.select2').each(function() { | |
return $(this).select2('destroy'); | |
}); | |
}); |
OlderNewer