Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View skatkov's full-sized avatar
🏠
Working from home

Stanislav (Stas) Katkov skatkov

🏠
Working from home
View GitHub Profile
@skatkov
skatkov / .zhenv
Created February 22, 2014 16:10
issue with prezto update
#
# Defines environment variables.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Ensure that a non-login, non-interactive shell has a defined environment.
if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
source "${ZDOTDIR:-$HOME}/.zprofile"
fi§
class MiniTest::Spec
def self.shared_examples
@shared_examples ||= {}
end
end
module MiniTest::Spec::SharedExamples
def shared_examples_for(desc, &block)
MiniTest::Spec.shared_examples[desc] = block
end
Chain INPUT (policy DROP)
target prot opt source destination
ufw-before-logging-input all -- anywhere anywhere
ufw-before-input all -- anywhere anywhere
ufw-after-input all -- anywhere anywhere
ufw-after-logging-input all -- anywhere anywhere
ufw-reject-input all -- anywhere anywhere
ufw-track-input all -- anywhere anywhere
Chain FORWARD (policy DROP)
@skatkov
skatkov / gist:4ab15b93d4924200c5d9
Created January 7, 2015 10:28
testing revolution :)
import requests
def visit(d):
print "Visit: %s" % d.url
if 'follow' in d.json():
visit(requests.get(next_link(d)))
else:
print d.text
def next_link(d):
<!DOCTYPE html SYSTEM>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Brokermint</title>
<style type="text/css">
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
@skatkov
skatkov / Bali
Last active August 29, 2015 14:18
hotels, wifi, prices, desc from Eric
## sCala
7-8.5mil/mo. Awesome pool. Very Posh. Breakfast incl. Neighborhood ok, halfway between Kuta and Canggu.
`0.3 down / 0.3 up`.
## Aqua blue
4.5/mo. Pool. 2nd floor. Kitchen in room w/ dishes. Desk and table. Neighborhood ok, (next to cScala).
`0.3 down / 1 up`.
## filadelphina bali guest house / kemiri home stay
aka Kemiri home stay (brother/sister joint business). 4.5 mil / mo. Basic. Desk. Bed. Aircon. Fridge kitchen share with owner. Pretty. Across from satu satu. Quiet road (raya pantai baway).
@skatkov
skatkov / gist:53e497c736c47d98ce92
Created May 7, 2015 08:24
spin-off heroku instances
#!/usr/bin/env ruby
$LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
require 'heroku'
require 'heroku/command/fork'
require 'heroku/command/run'
require 'github_api'
require 'heroku/client/pgbackups'
@skatkov
skatkov / gist:ffbbf7463101b4f5a5dd
Created May 8, 2015 15:52
removing all origin branches
git branch -a | grep /origin/ | awk -F/ '{print $3}'| xargs -I {} git push origin :{}
@skatkov
skatkov / HoneyBadgerFormatter
Created July 4, 2015 20:55
Honeybadger :: Rails.logger
class Logger::SimpleFormatter
def call(severity, time, progname, msg)
if Rails.env.production? && (severity == "FATAL" || severity == "ERROR")
@context = { :severity => severity.to_s, :time => time.to_s, :msg => msg.to_s }
Honeybadger.context(@context)
Honeybadger.notify(@context)
end
return "[#{severity}] #{msg}\n"
end
@skatkov
skatkov / mass_text_change.rb
Created June 22, 2012 11:47
change loads of text files in directory
#!/usr/bin/env ruby
folder = "Products_HTML/"
new_folder = "fixed_HTML/"
fileForChange = []
def changeFile(file_list, f, n)
Dir.mkdir(n)
file_list.each do |file_name|
text = File.read(f + file_name)
File.open(n + file_name, "w") {|file| file.puts text.gsub(/<a href=/, "<a style='color:blue' href=")}