Skip to content

Instantly share code, notes, and snippets.

View kpumuk's full-sized avatar

Dmytro Shteflyuk kpumuk

View GitHub Profile
@kpumuk
kpumuk / playstation2reddit.js
Last active May 30, 2017 19:15
Script to run from Chrome inspector that will fetch sale details and format them as a table with Reddit markup
$.getJSON('https://store.playstation.com/chihiro-api/viewfinder/US/en/19/' + location.hash.replace(/.*cid=([a-zA-Z0-9\-]+).*/, '$1') + '?size=300', function(d) {
var filteredLinks = $.grep(d.links, function(link) {
return link.playable_platform.find(function(platform) {
return !!platform.match(/^ps4/i);
});
});
var sortedLinks = filteredLinks.sort(function(a, b) {
if (a.name > b.name) return 1;
if (a.name < b.name) return -1;
@kpumuk
kpumuk / knife.rb
Created August 22, 2016 20:41
Enable bastion server for Chef knife
# ...
# your knife configurations goes here
# ...
# Bastion host SSH settings
knife[:bastion_host] = "bastion.mycorp.net"
knife[:bastion_user] = ENV["MYCORP_USER"] || ENV["CHEF_USER"] || ENV["USER"]
# If you have multiple networks, that require different MFA tokens, specify
# each network name here. (This configuration is referenced to clarify the

Keybase proof

I hereby claim:

  • I am kpumuk on github.
  • I am kpumuk (https://keybase.io/kpumuk) on keybase.
  • I have a public key ASD5jkBeIy7P3vePiTWy7fetU3oxNQQ0B_F6ElNzZHez1Qo

To claim this, I am signing this object:

@kpumuk
kpumuk / scribd_redhat_service_provider.rb
Last active August 29, 2015 14:20
Default Chef service provider for Centos 6 is totally fucked up. Fixing the damage with this
# Usage:
#
# service svc_name do
# provider Chef::Provider::Service::ScribdRedhat if node[:platform_family] == 'rhel' && node[:platform_version].to_i < 7
# supports status: true, restart: true, stop: true
# action :enable
# end
#
# or enable globally with
#
@kpumuk
kpumuk / gist:7518207
Created November 17, 2013 21:00
Compiling Ruby Enterprise Edition (ree) on Maverics with Homebrew
1. Run "rvm install ree", it failes
2. Run "cd ~/.rvm/src/ree-1.8.7-2012.02"
3. Make sure you have necessary libs installed: "brew install libyaml readline libksba openssl098"
3. Run this:
env CC=/usr/local/bin/gcc-4.2 CPP=/usr/local/bin/cpp-4.2 CXX=/usr/local/bin/g++-4.2 CFLAGS="-I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl098/include -I/opt/X11/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl098/lib -L$(xcrun --show-sdk-path)/usr/lib" CPPFLAGS="-I/opt/X11/include -I$(xcrun --show-sdk-path)/usr/include" ./installer -a /Users/kpumuk/.rvm/rubies/ree-1.8.7-2012.02 --no-tcmalloc --no-dev-docs --dont-install-useful-gems -c --without-tcl -c --without-tk -c --enable-shared -c --with-readline-dir=/usr/local/opt/readline
Should compile without problems
@kpumuk
kpumuk / skype fuckup
Last active December 24, 2015 20:49
Session with Skype support
Maria Rachelle N.
I have already checked your account and in accordance with paragraph 11.2 of the Skype Terms of Use we have terminated your right to use the Skype software, and have prevented any further access to your Skype account.
7:21:28 PM Maria Rachelle N.
This is because you are in breach of paragraph 6.3 (c) of the Terms of Use which prohibits the use of the Skype software to send unsolicited communications. Any Skype Credit that was in your account is non-refundable.
Maria Rachelle N.
Sorry for the inconvenience.
7:21:48 PM Maria Rachelle N.
Is there anything else I can help you with?
7:22:26 PM kpumuk
any more details? I did not do anything that violates your terms
socket(PF_NETLINK, SOCK_RAW, 0) = 9
bind(9, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
getsockname(9, {sa_family=AF_NETLINK, pid=8023, groups=00000000}, [12]) = 0
sendto(9, "\24\0\0\0\26\0\1\3h\272NR\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
recvmsg(9, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"0\0\0\0\24\0\2\0h\272NRW\37\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1\10\0\2\0\177\0\0\1\7\0\3\0lo\0\0<\0\0\0\24\0\2\0h\272NRW\37\0\0\2\32\200\0\6\0\0\0\10\0\1\0\n(\4`\10\0\2\0\n(\4`\10\0\4\0\n(\4\177\n\0\3\0bond0\0\0\0<\0\0\0\24\0\2\0h\272NRW\37\0\0\2\33\200\0\7\0\0\0\10\0\1\0\255\300@0\10\0\2\0\255\300@0\10\0\4\0\255\300@?\n\0\3\0bond1\0\0\0\376O\230%\24\0\6\0\377\377\377\377\377\377\377\377\252\5\0\0\252\5\0\0006}%=%t3%e%p1%d%;m\0\33[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m\0\33[M\0\33[3%p1%dm\0\33[4%p1%dm\0\33l\0\33m\0\1\0\0\0009\0s\0\242\2\1\0\377\377\0\0\7\0\16\0\25\0\34\0#\0*\0001\0008\0?\0F
@kpumuk
kpumuk / player.rb
Last active December 20, 2015 10:20
class Player
def play_turn(warrior)
case true
# Critical thinking
when dying_under_attack?(warrior) then warrior.walk! :backward
# Normal processing
when should_pivot?(warrior) then warrior.pivot!
# Can we shoot it?
when can_shoot?(warrior) then warrior.shoot!
# Need to rest?
@kpumuk
kpumuk / NativeIO.java
Created November 15, 2011 15:47
Patch for hadoop-common to make hadoop-native work on OS X
Index: src/core/org/apache/hadoop/io/nativeio/NativeIO.java
--- src/core/org/apache/hadoop/io/nativeio/NativeIO.java 2011-11-14 23:51:25.000000000 -0500
+++ src/core/org/apache/hadoop/io/nativeio/NativeIO.java 2011-10-14 04:39:58.000000000 -0400
@@ -37,15 +37,15 @@
public static final int O_RDONLY = 00;
public static final int O_WRONLY = 01;
public static final int O_RDWR = 02;
- public static final int O_CREAT = 0100;
- public static final int O_EXCL = 0200;
- public static final int O_NOCTTY = 0400;
@kpumuk
kpumuk / fires_event.rb
Created June 15, 2011 22:17
Contains the FiresEvent module and extensions to ActiveRecord::Base for adding event-related after_save hooks to models.
# Contains the FiresEvent module and extensions to ActiveRecord::Base for
# adding event-related after_save hooks to models.
# Adds methods to ActiveRecord::Base for working with events.
class ActiveRecord::Base
class_attribute :skip_events, :instance_writer => false
class << self