Skip to content

Instantly share code, notes, and snippets.

View Nowaker's full-sized avatar

Damian Nowak Nowaker

View GitHub Profile
@Nowaker
Nowaker / flavors.json
Created December 8, 2017 19:31
OpenStack Compute Flavors in DreamCompute
{
"items": [{
"name": "gp1.subsonic",
"links": [{
"href": "https://iad2.dream.io:8774/v2/4bf0011c1ae9448f8a1ad1cb25159eb4/flavors/100",
"rel": "self"
}, {
"href": "https://iad2.dream.io:8774/4bf0011c1ae9448f8a1ad1cb25159eb4/flavors/100",
"rel": "bookmark"
}],
### Keybase proof
I hereby claim:
* I am Nowaker on github.
* I am nowaker (https://keybase.io/nowaker) on keybase.
* I have a public key whose fingerprint is 7205 280D 7BF0 E93E 4698 584F 9F14 E954 D7BC 8F6F
To claim this, I am signing this object:
@Nowaker
Nowaker / gist:5f5ba3fe049993da3811
Created January 21, 2016 04:03 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
#!/usr/bin/env node
var spdy = require('spdy'),
crypto = require('crypto'),
fs = require('fs');
b64decode = function(encoded) {
return new Buffer(encoded || '', 'base64').toString('utf8');
};
var http = require("http")
, util = require("sys") // 0.3.x: require("util")
, fs = require("fs")
, client = http.createClient(80, "example.com")
, request = client.request("POST", "/", {"host":"example.com"})
// send body chunks
request.write("hello, world")
// pump a file through
@Nowaker
Nowaker / devise.pl.yml
Created March 2, 2012 14:56
Devise 2.0.1 polish translation
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
# Devise v1.4.6 polish translation by saepia based on @rogal111's translation
# Devise 2.0.0 updates by @kszksz
# Language updates by @Nowaker - bardziej zrozumiałe instrukcje (np. unconfirmed - sama informacja, że konto jest
# nieaktywne nie jest wystarczająca - trzeba powiedzieć, co trzeba zrobić by je aktywować), bardziej naturalne zwroty
# (unikanie strony biernej, więcej emocji w witaniu itp.), zakomentowanie zdeprecjonowanych wiadomości,
# dodanie "update_needs_confirmation" (Devise 2.0.1?)
pl:
errors:
@Nowaker
Nowaker / iebuttonfix.js
Created March 1, 2012 13:00 — forked from kamranayub/iebuttonfix.js
IE 7 and below <button> tag value on POST fix
$(document).ready(function() {
if ($.browser.msie && ($.browser.version === "7.0" || $.browser.version === "6.0")) {
var getButtonValue = function($button) {
var label = $button.text();
$button.text('');
var buttonValue = $button.val();
$button.text(label);
return buttonValue;
}
@Nowaker
Nowaker / gist:1947108
Created March 1, 2012 03:42
calling method from specific module, even if another module overwrote the method
irb(main):001:0> module A; def a; puts 'a'; end; end
=> nil
irb(main):002:0> module B; def a; puts 'b'; end; end
=> nil
irb(main):003:0> class Blah; include A; include B; end
=> Blah
irb(main):004:0> Blah.new.a()
b
@Nowaker
Nowaker / gist:1946964
Created March 1, 2012 03:15
attr_reader and attr_writer on class instance
class Magic
def property types, method_name, property_name = nil
property_name = method_name if property_name.nil?
# reader
self.class.send :define_method, method_name do
value = read_value property_name
raise unless types.any? do |type|
value.is_a? type