Skip to content

Instantly share code, notes, and snippets.

View mytrile's full-sized avatar

Dimitar Kostov mytrile

View GitHub Profile
@mytrile
mytrile / add_pinned_tabs_chrome
Created January 2, 2010 21:45
Pinned tabs in Google Chrome
# Add pinned tabs in Google Chrome
# add as argument to Google Chrome : --pinned-tab-count=2 http://google.com/ http://www.google.com/reader/view/
# example: /opt/google/chrome/google-chrome %U --pinned-tab-count=2 http://google.com/ http://www.google.com/reader/view/
require 'artoo'
connection :sphero, adaptor: :sphero, port: '4560'
device :sphero, driver: :sphero
work do
every(3.seconds) do
puts "Rolling..."
sphero.roll 60, rand(360)
end
@mytrile
mytrile / example.database.mysql.extra
Created October 16, 2018 11:32 — forked from karuna/example.database.mysql.extra
database.yml collection
pool: number indicating size of connection pool (default 5)
checkout_timeout: number of seconds to block and wait for a connection before giving up and raising a timeout error (default 5 seconds).
reaping_frequency: frequency in seconds to periodically run the Reaper, which attempts to find and close dead connections, which can occur if a programmer forgets to close a connection at the end of a thread or a thread dies unexpectedly. (Default nil, which means don't run the Reaper).
dead_connection_timeout: number of seconds from last checkout after which the Reaper will consider a connection reapable. (default 5 seconds).
encoding: (Optional) Sets the client encoding by executing "SET NAMES <encoding>" after connection.
reconnect: Defaults to false (See MySQL documentation: dev.mysql.com/doc/refman/5.0/en/auto-reconnect.html).
strict: Defaults to true. Enable STRICT_ALL_TABLES. (See MySQL documentation: dev.mysql.com/doc/refman/5.0/en
@mytrile
mytrile / richhickey.md
Created April 18, 2018 06:01 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

def currency_euro(item)
number_to_currency(item, :unit => "&euro;", :separator => ",", :delimiter => "", :format => "%n %u")
end
@mytrile
mytrile / flood_router26.sh
Created December 17, 2012 08:33
This is an IPv6 RA flood attack that kills iPads and Macs and Android
#!/bin/bash
#
# This is an IPv6 RA flood attack that kills iPads and Macs and Android.
# For videos and details:
# http://samsclass.info/ipv6/proj/RA_flood2.htm
#
if [ "$#" -ne 3 ]
then
echo "Usage: ./6shooter1.7 P d t"
@mytrile
mytrile / TestVertxWeb.kt
Created November 19, 2016 20:36 — forked from itang/TestVertxWeb.kt
Test Vertx Web
package demo
import io.vertx.core.Vertx
import io.vertx.core.http.HttpServer
import io.vertx.core.http.HttpServerResponse
import io.vertx.ext.web.Route
import io.vertx.ext.web.Router
import io.vertx.ext.web.RoutingContext
fun Router.get(path: String, handler: (RoutingContext) -> Unit): Route {
@mytrile
mytrile / description.markdown
Created October 10, 2016 12:30 — forked from runemadsen/description.markdown
Reverse polymorphic associations in Rails

Polymorphic Associations reversed

It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling @article.media

This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.

@mytrile
mytrile / Dockerfile
Created August 4, 2016 08:17 — forked from sergio1990/Dockerfile
Elixir in Docker
FROM elixir:1.2.3
MAINTAINER Sergey Gernyak <sergeg1990@gmail.com>
ENV MIX_ENV=prod
RUN apt-get update && apt-get install -y build-essential git-core
RUN mkdir -p /app
WORKDIR /app