Skip to content

Instantly share code, notes, and snippets.

View yltsrc's full-sized avatar

Yura Tolstik yltsrc

View GitHub Profile
@yltsrc
yltsrc / Sidekiq Reset
Created January 25, 2016 13:45 — forked from unkleara/Sidekiq Reset
Sidekiq reset stats
To reset processed jobs:
Sidekiq.redis {|c| c.del('stat:processed') }
To reset failed jobs:
Sidekiq.redis {|c| c.del('stat:failed') }
To reset statistics:
Sidekiq::Stats.new.reset
require 'spec_helper'
require 'active_support/core_ext/string/inflections'
RSpec.describe 'TestSuite' do
Dir['{app,lib}/**/*.rb'].each do |filename|
context filename do
subject { filename }
let(:testfile) do
filename
var http = require('http');
var https = require('https');
var fs = require("fs")
var options = {
key: fs.readFileSync("ssl.key"),
cert: fs.readFileSync("ssl.crt")
}
https.createServer(options, onRequest).listen(8443);
@yltsrc
yltsrc / how-to-set-up-stress-free-ssl-on-os-x.md
Created October 22, 2015 12:42 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

# part of my library
defmodule FooLib do
defprotocol BarProtocol do
def bar(value)
end
defimpl BarProtocol, for: List do
def bar([h | _rest]), do: h
end
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@yltsrc
yltsrc / pre-commit
Last active December 25, 2015 06:29
git pre commit hook with code review and test runner
#!/usr/bin/env bash
if [[ "$(git rev-parse --abbrev-ref HEAD)" == "master" ]]; then
echo "Please do not commit to master!";
exit 1;
else
exit 0;
fi
@yltsrc
yltsrc / .git_prompt
Last active October 5, 2015 19:27
bash git prompt
# git prompt
DULL=0
FG_BLACK=30
FG_RED=31
FG_GREEN=32
FG_YELLOW=33
FG_BLUE=34
FG_CYAN=36
FG_WHITE=37
BG_NULL=00
cat /etc/apparmor.d/usr.bin.skype
# Last Modified: Sat 19 Dec 2009 23:50:49 GMT 2009
#include <tunables/global>
/usr/bin/skype {
#include <abstractions/audio>
#include <abstractions/base>
#include <abstractions/bash>
#include <abstractions/gnome>
#include <abstractions/kde>