Skip to content

Instantly share code, notes, and snippets.

View viktor-evdokimov's full-sized avatar
👷‍♂️
Focusing

Viktor Evdokimov viktor-evdokimov

👷‍♂️
Focusing
View GitHub Profile
@viktor-evdokimov
viktor-evdokimov / automation.md
Created June 17, 2016 04:57 — forked from cube-drone/automation.md
Automation For The People

Automation for the People

Long ago, the first time I read "The Pragmatic Programmer", I read some advice that really stuck with me.

"Don't Use Manual Procedures".

This in the chapter on Ubiquitous Automation. To summarize, they want you to automate all the things.

The trouble was that I hadn't much of an idea how to actually go

+ case "$(lsb_release -si)" in
++ lsb_release -si
+ export DOKKU_DISTRO=ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins

Creating a redis Module in 15 lines of code!

A quick guide to write a very very simple "ECHO" style module to redis and load it. It's not really useful of course, but the idea is to illustrate how little boilerplate it takes.

Step 1: open your favorite editor and write/paste the following code in a file called module.c

#include "redismodule.h"
/* ECHO <string> - Echo back a string sent from the client */
int EchoCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
@viktor-evdokimov
viktor-evdokimov / Build.xml
Created May 8, 2016 07:08 — forked from NickCraver/Build.xml
Stack Overflow Build Reference Docs
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="PrepareStaticContent" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Passed in Parameters -->
<configuration></configuration>
<workingDir></workingDir>
<buildNumber></buildNumber>
<buildViews>false</buildViews>
<minifyJs>true</minifyJs>
<TargetsDirectory></TargetsDirectory>
@viktor-evdokimov
viktor-evdokimov / gist:bc6c4287904dea3e81803e2a35a7231b
Created April 11, 2016 14:27 — forked from mikhailov/gist:9639593
Nginx S3/Unicorn Proxy with backend keep alive
# The Nginx configuration based on https://coderwall.com/p/rlguog
http {
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_timeout 15m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
@viktor-evdokimov
viktor-evdokimov / web-servers.md
Created February 13, 2016 07:55 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@viktor-evdokimov
viktor-evdokimov / archive.sh
Last active January 17, 2016 00:41
create tar ball from git
git archive --format=zip --remote=ssh://github.com/me/repo.git -o repo.zip HEAD
@viktor-evdokimov
viktor-evdokimov / clojure-clr-webserver.cs
Created October 22, 2015 17:50 — forked from zdam/clojure-clr-webserver.cs
Use clojureCLR inside an asp.net MVC app
/*
* This is a litle tech demo to demonstrate using clojureCLR in a CLR web app.
*
* A custom IHttpHandler (ClojureHttpHandler) handles invocation of clojure code,
* and a custom IRouteHandler (ClojureRouteHandler) routes requests to the HttpHandler.
*
* See comments in the code for further detail.
*
* Cheers, zdam
* http://zimpler.com/blog/clojureclr-in-an-asp-net-mvc-app
@viktor-evdokimov
viktor-evdokimov / nginx.conf
Created October 7, 2015 01:53 — forked from timmyomahony/nginx.conf
Python, UWSGI, Supervisor & Nginx
upstream uwsgi {
ip_hash;
server 127.0.0.1:40000;
}
server {
listen 80;
server_name www.domain.com;
root /sites/mysite/;
access_log /sites/mysite/log/nginx/access.log;
@viktor-evdokimov
viktor-evdokimov / expensive.sql
Created September 25, 2015 19:36
expensive queries sql server 2008+
SELECT TOP 10 SUBSTRING(qt.TEXT, (qs.statement_start_offset/2)+1,
((CASE qs.statement_end_offset
WHEN -1 THEN DATALENGTH(qt.TEXT)
ELSE qs.statement_end_offset
END - qs.statement_start_offset)/2)+1),
qs.execution_count,
qs.total_logical_reads, qs.last_logical_reads,
qs.total_logical_writes, qs.last_logical_writes,
qs.total_worker_time,
qs.last_worker_time,