Skip to content

Instantly share code, notes, and snippets.

View fbarriosCL's full-sized avatar
:octocat:
Happy

Felipe Barrios fbarriosCL

:octocat:
Happy
View GitHub Profile
# Delete containers in state 'Exit'
00 3 * * 6 /usr/bin/docker rm $(sudo docker ps -a | grep Exit | cut -d ' ' -f 1)
# Delete old images every Sunday at 3:10 a.m
10 3 * * 6 /usr/bin/docker rmi $(docker images | tail -n +2 | awk '$1 == "<none>" {print $'3'}')
# Delete orphan volumes every Sunday at 3:20 a.m.
20 3 * * 6 /usr/bin/docker volume rm $(docker volume ls -qf dangling=true)
#!/bin/bash
fallocate -l 16G /swapfile
mkswap /swapfile
swapon /swapfile
swapon -s
sysctl vm.swappiness=65
class Login
attr_reader :sessions, :users
# Receives a array with hash with usernames and passwords
def initialize(db = {})
@sessions = []
@users = db
end
# check if user exists
require 'nmap'
require 'net/http'
require 'json'
module Nmap
# monkey patch equals to the commit:
# https://github.com/sophsec/ruby-nmap/commit/1404475c7fb879a71f661a3acdad77b453152a0e
module CPE
def each_cpe
return enum_for(__method__) unless block_given?
@fbarriosCL
fbarriosCL / Transantiago public endpoints.md
Created July 12, 2017 03:42 — forked from radutzan/Transantiago public endpoints.md
APIs REST públicas con data del Transantiago. Respuestas en JSON.

Paraderos alrededor de un punto

http://www.transantiago.cl/restservice/rest/getpuntoparada?lat=-33.6089714&lon=-70.5742975&bip=1

Estimación de parada

http://www.transantiago.cl/predictor/prediccion?codsimt=PA420&codser=504 (código de servicio es opcional, pero el parámetro debe estar presente aunque esté vacío)

Lista de servicios

http://www.transantiago.cl/restservice/rest/getservicios/all

Info completa de servicio

@fbarriosCL
fbarriosCL / search.rb
Last active June 21, 2017 16:05
Example of search with get searchkick and elasticsearch-model
class Search < ApplicationRecord
enum category: [:aplication_movil , :web_applications_auditing, :wireless_audits, :forensic, :network_audit, :pentesting, :server_administration, :programming, :other]
enum document_type: [:post, :user, :discussion, :job, :course, :video]
has_many :searches, class_name: "Searchjoy::Search", as: :convertable
searchkick conversions: ["conversions", "total_conversions"],
language: "spanish",
suggest: [:title],
#!/usr/bin/python
import requests
#abrimos nuestro diccionario
wordlist = open("wordlist.txt","r")
require 'dotenv'
Dotenv.load
require 'aws-sdk'
client = Aws::Rekognition::Client.new
resp = client.detect_labels(
image: { bytes: File.read(ARGV.first) }
)
resp.labels.each do |label|
puts "#{label.name}-#{label.confidence.to_i}"
end
AWS_REGION=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
@fbarriosCL
fbarriosCL / Gemfile
Created December 19, 2016 21:01
Gemfile
source 'https://rubygems.org'
gem 'dotenv'
gem 'aws-sdk'