Skip to content

Instantly share code, notes, and snippets.

bonyiii

Block or report user

Report or block bonyiii

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bonyiii
bonyiii / gist:1471379
Created Dec 13, 2011
restore overwritten files linux
View gist:1471379
http://www.ehow.com/how_7517984_restore-overwritten-file-linux.html
Assess which partition on your computer you need to access to recover the files.
2
Unmount the directory using the "unmount" command in the interface. This will help prevent damaging the file you are trying to recover.
3
Type "debugfs" in the command line interface (all typing without quotation marks) and include the file system where the overwritten file is into the command. For example, typing "debugfs usr/personal" will bring up your personal directory. Hit "Enter" after typing the command.
4
@bonyiii
bonyiii / gist:6184489
Created Aug 8, 2013
ruby multithread
View gist:6184489
http://speakmy.name/2013/04/02/concurrent-programming-and-threads-in-ruby-reading-list/
Concurrent Programming and Threads in Ruby - a reading list
02 April 2013
Many rubyists consider threads in Ruby as somewhat of an arcane knowledge, though in reality they’re a very well researched and understood concept. Of course, writing effective multithreaded concurrent programs requires certain amount of knowledge and discipline from the programmer, but there’s nothing that a smart one can’t learn if he wants to.
To help with the task, awesome @brainopia compiled a list of recommended reading on the topic of concurrency and threads. All kudos go to @brainopia, and the original list in Russian as available as a gist here:
@bonyiii
bonyiii / gist:1901621
Created Feb 24, 2012
mysqlreport explanation
View gist:1901621
Other great tool:
https://launchpad.net/mysql-tuning-primer
Hack MySQL ‹ mysqlreport ‹ Download ‹ Guide › Documentation
Blog Contact Sitemap
This web site is no longer maintained. Read why.
@bonyiii
bonyiii / gist:884681
Created Mar 24, 2011
How to create diff file for gentoo ebuild patch
View gist:884681

An example to patch unixODBC-2.3.0 on a 64bit machine to work with oracle 8.

First download unixODBC source. mkdir /tmp/unixODBC/source

Create two new folder. mkdir /tmp/unixODBC/patch/original mkdir /tmp/unixODBC/patch/unixODBC-2.3.0/DriverManager/

cp /tmp/unixODBC/source/unixODBC-2.3.0/DriverManager/SQLConnect.c /tmp/unixODBC/patch/original
@bonyiii
bonyiii / start_rails_api.sh
Last active Jan 11, 2017
Start Rails Application
View start_rails_api.sh
docker run -it \
--name sapi \
-p 3000:3000 \
--security-opt seccomp:chrome.seccomp.json \
-e DISPLAY=unix$DISPLAY \
-v /home/boni/public_html/app/my-api/gems:/usr/local/bundle \
-v /home/boni/public_html/app/my-api:/var/www/my-api \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/Downloads:/home/dev/Downloads \
-v $HOME/.config/google-chrome/:/home/dev/data \
View rails_api.entrypoint.sh
#!/bin/bash
set -e
case "$1" in
rails|rake|passenger)
# ensure the right database adapter is active in the Gemfile.lock
if [ -z "$NO_BUNDLE" ]; then
# bundle install --without development test
bundle install
chown dev:dev $GEM_HOME -R
@bonyiii
bonyiii / rails_api.Dockerfile
Created Dec 19, 2016
Rails application dockerfile
View rails_api.Dockerfile
FROM myapp-base
RUN mkdir -p /var/www/myapp-api && chown dev /var/www/myapp-api
WORKDIR /var/www/myapp-api
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 3000
@bonyiii
bonyiii / base_imgage.Dockerfile
Created Dec 19, 2016
How to set up rails development with docker base image
View base_imgage.Dockerfile
# original idea taken from
# https://github.com/docker-library/redmine/blob/d564a3b0d78016b2f24af2d74bcdace26a1ac0a3/3.1/Dockerfile
FROM ruby:2.3
MAINTAINER Bonaventura Fleischmann <bonaventura.fleischmann@digitalnatives.hu>
# Add user whose name the app will be run within the container
# the user id should be the default first linux user id
RUN useradd -u 1000 dev
@bonyiii
bonyiii / gist:2158289
Created Mar 22, 2012
Rails ajax link_to remote with put, post
View gist:2158289
http://www.kolodvor.net/2010/01/02/rails-csrf-and-ajax-requests/
http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html#M000514
http://stackoverflow.com/questions/5241213/rails-session-is-blank-when-using-http-put
Key thing is to add form_authenticity_token to path param as a query_string
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
<%= link_to 'Reset', null_counter_model_path(model, :authenticity_token => form_authenticity_token), :confirm => 'Are you sure?', :method => :put, :remote => true %>
@bonyiii
bonyiii / mailer.rb
Created Jul 31, 2016
Redmine mailer with sending attachments
View mailer.rb
# Redmine - project management software
# Copyright (C) 2006-2016 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
You can’t perform that action at this time.