Skip to content

Instantly share code, notes, and snippets.

View kzaitsev's full-sized avatar

Kirill Zaitsev kzaitsev

  • Limassol, Cyprus
View GitHub Profile
@davydovanton
davydovanton / dry_monads_with_handler.rb
Last active February 20, 2019 13:06
dry_monads_with_handler
def result_handler(result)
case result
when Success, Some
puts 'success, user created'
when Failure { |message, _| message == :http_error }
puts "HTTP request error, #{result.failure[2]}"
when Failure { |message, _| message == :validation_error }
puts "validation error, #{result.failure[2]}"
when Failure(ROM::Error)
puts 'User not created'
@tkon99
tkon99 / name.js
Last active April 19, 2024 14:38
Random Name Generator for Javascript
/*
(c) by Thomas Konings
Random Name Generator for Javascript
*/
function capFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function getRandomInt(min, max) {
@anujb
anujb / gist:4528263
Created January 14, 2013 06:54
Gorilla json-rpc sample
package main
import (
"github.com/gorilla/rpc"
"github.com/gorilla/rpc/json"
"net/http"
)
type HelloArgs struct {
Who string
@codeinthehole
codeinthehole / run.py
Created November 21, 2012 13:46
Sample Celery chain usage for processing pipeline
from celery import chain
from django.core.management.base import BaseCommand
from . import tasks
class Command(BaseCommand):
def handle(self, *args, **kwargs):
@bradmontgomery
bradmontgomery / sshserver.rb
Created October 25, 2012 18:28
Chef role that sets up sshd with an enabled SFTP subsystem. I use `upload_project` in fabric, and after moving to a Chef-based system I started getting `ssh.SSHException: Channel closed` errors.
name "sshserver"
description "Configures SSH and enables SFTP"
run_list(
"recipe[openssl::default]",
"recipe[openssh]",
)
default_attributes(
"openssh" => {
"server" => {
"subsystem" => "sftp /usr/lib/openssh/sftp-server" # path for Ubuntu; ymmv
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 20, 2024 12:37
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname