This file contains hidden or 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
| [Unit] | |
| Description=xmr-stak miner | |
| After=syslog.target network.target | |
| [Service] | |
| Type=simple | |
| # interesting info about starting as regular user: https://bbs.archlinux.org/viewtopic.php?id=162297 | |
| User=username | |
| LimitMEMLOCK=256M | |
| EnvironmentFile=-/etc/sysconfig/xmr-stak |
This file contains hidden or 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
| @Grapes([ | |
| @Grab(group='org.gperfutils', module='gbench', version='[0.4,)'), | |
| @Grab(group='org.apache.commons', module='commons-lang3', version='[3.7,)'), | |
| @Grab(group='joda-time', module='joda-time', version='[2.9.9,)') | |
| ]) | |
| /** | |
| * Java 8 DateTimeFormatter | |
| */ | |
| import java.util.Date; |
This file contains hidden or 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
| // clone in sub-directory | |
| checkout([ | |
| $class: 'GitSCM', | |
| branches: [[name: 'master']], | |
| doGenerateSubmoduleConfigurations: false, | |
| extensions: [[ | |
| $class: 'RelativeTargetDirectory', | |
| relativeTargetDir: 'some/path' | |
| ]], | |
| submoduleCfg: [], |
This file contains hidden or 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 'builder' | |
| # See more about syntax on | |
| # http://api.rubyonrails.org/classes/ActionView/Base.html | |
| # https://github.com/jimweirich/builder | |
| # http://builder.rubyforge.org/ | |
| xml = +"" | |
| builder = Builder::XmlMarkup.new(target: xml, indent: 2) | |
| builder.rootelementname { |x| |
This file contains hidden or 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
| # rest-client recognizes files in multipart/form-data by checking | |
| # the object type passed as the field content. We need to craft | |
| # our string to appear as a file IO. `#stringfile` does that. | |
| # An alternative approach is to just write string to a file and | |
| # pass file IO to rest-client but this would be suboptimal | |
| # provided we already have the content as a String. | |
| def stringfile(string, | |
| filename="file_#{rand 100000}", | |
| type=MIME::Types.type_for("xml").first.content_type) |
This file contains hidden or 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
| pr = %q{puts %{pr = %q{#{pr}}}, pr} | |
| puts %{pr = %q{#{pr}}}, pr |
This file contains hidden or 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
| # run by `ruby rails_test.rb` | |
| # credits to https://github.com/rails/rails/issues/13744#issuecomment-32670636 | |
| gem 'activerecord', '5.0.0.1' | |
| require 'active_record' | |
| require 'minitest/autorun' | |
| require 'logger' | |
| # Ensure backward compatibility with Minitest 4 | |
| Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) |
This file contains hidden or 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
| # LICENSE: MIT, wtfpl or whatever OSS license you like | |
| function get_stack () { | |
| STACK="" | |
| local i message="${1:-""}" | |
| local stack_size=${#FUNCNAME[@]} | |
| # to avoid noise we start with 1 to skip the get_stack function | |
| for (( i=1; i<$stack_size; i++ )); do | |
| local func="${FUNCNAME[$i]}" | |
| [ x$func = x ] && func=MAIN | |
| local linen="${BASH_LINENO[$(( i - 1 ))]}" |
This file contains hidden or 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 'io/console' | |
| require 'wsse' | |
| header = WSSE::header('username', STDIN.noecho(&:gets).chomp) | |
| def wsse_xml(user, password) | |
| raw = WSSE::header(user, password) | |
| # username = raw.gsub(/^.* Username="(.*)", PasswordDigest=".*(?!PasswordDigest)$/, '\\1') | |
| digest = raw.gsub(/^.*, PasswordDigest="(.*)", Nonce=".*$/, '\\1') | |
| nonce = raw.gsub(/^.*, Nonce="(.*)", Created=".*$/, '\\1') |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| # see https://github.com/sparklemotion/nokogiri/issues/1200 | |
| require 'nokogiri' | |
| src =<<EOD | |
| <wrapper xmlns="ns"> | |
| <record xml:id="r1" xmlns:extra="extra"> | |
| <field>aaa</field> |