Skip to content

Instantly share code, notes, and snippets.

View Jeiwan's full-sized avatar
🛠️
Write code, delete code, repeat

Ivan Kuznetsov Jeiwan

🛠️
Write code, delete code, repeat
View GitHub Profile
@Jeiwan
Jeiwan / ar_migrate.rb
Created February 9, 2016 05:06 — forked from icyleaf/ar_migrate.rb
ActiveRecord type of integer (tinyint, smallint, mediumint, int, bigint)
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb
# Maps logical Rails types to MySQL-specific data types.
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
return super unless type.to_s == 'integer'
case limit
when 1; 'tinyint'
when 2; 'smallint'
when 3; 'mediumint'
when nil, 4, 11; 'int(11)' # compatibility with MySQL default

Keybase proof

I hereby claim:

  • I am jeiwan on github.
  • I am jeiwan (https://keybase.io/jeiwan) on keybase.
  • I have a public key whose fingerprint is 9572 6E1E 203D 58CC E194 83C3 4931 B584 29A0 7886

To claim this, I am signing this object:

@Jeiwan
Jeiwan / nginx_reverse_proxy.conf
Created February 19, 2017 09:01
NGINX reverse proxy with SSL
events {
worker_connections 1024;
}
http {
server {
listen 80;
listen 443 default ssl;
server_name SERVER_NAME;
@Jeiwan
Jeiwan / docker-cleanup-resources.md
Created December 19, 2017 01:46 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@Jeiwan
Jeiwan / README.md
Created January 3, 2018 07:30 — forked from e7d/README.md
[Debian] Setup a Squid anonymous proxy
@Jeiwan
Jeiwan / gist:e14d00f8c17db7b449585101472b6bd2
Created March 2, 2018 09:44 — forked from clintel/gist:1155906
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@Jeiwan
Jeiwan / graceful.go
Created July 6, 2018 06:54 — forked from peterhellberg/graceful.go
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
@Jeiwan
Jeiwan / core.clj
Created July 5, 2017 00:55
Custom log4j appender in Clojure
(ns woof.core
(:gen-class)
(:require [clojure.tools.logging :as log])
(:import StringAppender))
(defn -main
"I don't do a whole lot ... yet."
[& args]
(log/info "Hello, world!")
(println "Done")

Identifying Arbitrage Opportunities with Graphs


Introduction

@Jeiwan
Jeiwan / s3_object_tagging.clj
Created January 31, 2017 08:13
S3 Object Tagging with Amazonica
(require '[amazonica.aws.s3 :as s3])
(import '[com.amazonaws.services.s3.model Tag ObjectTagging])
(def bucket "bucket")
(def kkey "key")
(def file (clojure.java.io/file "file"))
(defn tags->tagging [tags]
(->> tags
clojure.walk/stringify-keys