Skip to content

Instantly share code, notes, and snippets.

View andrius's full-sized avatar

Andrius Kairiukstis andrius

View GitHub Profile
module Configuration
Error = Class.new StandardError
class << self
def config(&block)
@config ||= initialize_config
block_given? and yield @config
@config
end
class CreateUsers
end
Sequel.migration do
change do
create_table :users do
primary_key :id
String :email
String :encrypted_password
@andrius
andrius / blogger-to-jekyll.rb
Created October 5, 2014 08:04
Import blogger.com to the jekyll
ruby -rubygems -e 'require "jekyll-import";
JekyllImport::Importers::Blogger.run({
"source" => "/Users/ak/Desktop/blog-10-02-2014.xml",
"no-blogger-info" => false, # not to leave blogger-URL info (id and old URL) in the front matter
"replace-internal-link" => false, # replace internal links using the post_url liquid tag.
})'
@andrius
andrius / fix-permissions.sh
Created September 30, 2015 12:15
Fixes file permissions in Dropbox folder (windows make them wrong)
#!/bin/sh
cd ~/Dropbox
# Remove conflicted copies
find . -iname '*conflicted copy*' | \
awk -F '-8-8-8-8-8-' '{print "\""$1"\""}' | xargs rm -rf
find . -type f \
-perm 755 \
@andrius
andrius / osx-for-hackers.sh
Last active July 21, 2022 22:44 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox... #macos #setup #dotfiles
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@andrius
andrius / Procfile
Last active July 22, 2022 22:00
How to dockerize #rails app with #puma. Edit config/application.rb and config/puma.rb #docker #ruby
api: bundle exec puma -C config/puma.rb

Keybase proof

I hereby claim:

  • I am andrius on github.
  • I am andrius_mobi (https://keybase.io/andrius_mobi) on keybase.
  • I have a public key whose fingerprint is 531E BDD4 2E17 31A4 27C4 BED9 FA85 A2DD 963A 379F

To claim this, I am signing this object:

# terminate block.call after given timeout
# https://github.com/crystal-lang/crystal/issues/2990
module Timeout
def self.timeout(terminate_after : Float64, &block)
ch = Channel(Bool).new
spawn do
sleep terminate_after
ch.close
end
@andrius
andrius / mac_ip.sh
Last active March 26, 2018 19:37
IP address of docker host (mac) in shell scripts. Only works with #docker for #macos
#!/bin/sh
# Tested on alpine linux
# Thanks to `docker.for.mac.localhost` (or `docker.for.mac.host.internal`)
# featured in https://docs.docker.com/docker-for-mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host,
# it's possible to access host (mac) services
# mac_ip will set IP address (MAC_IP) of mac visible from docker container and
# return code (0 = IP found, 1 = not found)
mac_ip() {
@andrius
andrius / installDante.sh
Created February 28, 2018 11:57 — forked from Fire-/installDante.sh
Basic Dante Socks5 Server Setup and Configuration
# Basic Dante Socks5 Setup, Debian
apt-get update
apt-get install make gcc
cd /usr/src
# get newest from http://www.inet.no/dante/download.html
wget http://www.inet.no/dante/files/dante-1.4.1.tar.gz