Skip to content

Instantly share code, notes, and snippets.

//
// DeviceDriver.swift
// spt
//
// Created by Diogo Andre de Assumpcao on 22/10/18.
import RealmSwift // Realm Mobile Database. Used instead of CoreData.
import Alamofire // HTTP networking library written in Swift.
class DeviceDriver {
[2017-12-15T11:13:12,932][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"fb_apache", :directory=>"/data/elk/logstash-6.0.1/modules/fb_apache/configuration"}
[2017-12-15T11:13:12,935][DEBUG][logstash.plugins.registry] Adding plugin to the registry {:name=>"fb_apache", :type=>:modules, :class=>#<LogStash::Modules::Scaffold:0x7309d925 @module_name="fb_apache", @directory="/data/elk/logstash-6.0.1/modules/fb_apache/configuration", @kibana_version_parts=["6", "0", "0"]>}
[2017-12-15T11:13:12,935][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"netflow", :directory=>"/data/elk/logstash-6.0.1/modules/netflow/configuration"}
[2017-12-15T11:13:12,936][DEBUG][logstash.plugins.registry] Adding plugin to the registry {:name=>"netflow", :type=>:modules, :class=>#<LogStash::Modules::Scaffold:0x6064ef34 @module_name="netflow", @directory="/data/elk/logstash-6.0.1/modules/netflow/configuration", @kibana_version_parts=["6", "0", "0"]>}
[2017-12-15T11:13:13,090][DEBUG][logstash.runn
0x30a5F319ac331Af886AC2B5A53700c6D2125a78a
class ChildLayout < MK::Layout
def layout
add UIView, :logo_container do
add UIImageView, :logo_image
end
end
def logo_image_style
frame [[0, 0], [50, 198]]
image UIImage.imageNamed('logo-azul')
@DiogoAndre
DiogoAndre / gist:8f5cc66024217d34c465
Last active May 12, 2018 21:50
Use font icon to create a NSMutableAttributedString in RubyMotion

Get the font files from http://octicons.github.com and copy the octicons-local.ttf file to the /resources directory at the root of your project.

my_icon = NSMutableAttributedString.alloc.initWithString("\uf00e")
my_icon.addAttribute(NSFontAttributeName, value: NSFont.fontWithName("github-octicons",size:30), range: NSMakeRange(0, 1))

The string in initWithString will be the unicode value of the char that represents the icon you want. You can check the unicode value for the icons in the CSS file that comes when you download the font.You can also get the unicode value when you select an icon on octicons.github.com.

@DiogoAndre
DiogoAndre / ping.rb
Last active January 3, 2024 09:08
Simple ICMP Ping script in Ruby. Using the Net-Ping gem https://github.com/djberg96/net-ping
require 'net/ping'
@icmp = Net::Ping::ICMP.new('142.40.81.34')
rtary = []
pingfails = 0
repeat = 5
puts 'starting to ping'
(1..repeat).each do
if @icmp.ping
@DiogoAndre
DiogoAndre / gist:4724373
Created February 6, 2013 17:46
Ubuntu locale warning messages
sudo apt-get install language-pack-pt-base
# where pt is your actual language base, ie. en,fr
@DiogoAndre
DiogoAndre / gist:2661478
Created May 11, 2012 18:17
Authenticated API call to the GitHub Users v3 API in Ruby
require 'net/http'
uri = URI('https://api.github.com/user')
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
request = Net::HTTP::Get.new uri.request_uri
request.basic_auth 'username', 'password'
response = http.request request
puts response.body
end