Skip to content

Instantly share code, notes, and snippets.

View megatux's full-sized avatar
🏠
Working from home

Cristian Molina megatux

🏠
Working from home
View GitHub Profile
@megatux
megatux / Convert PostgreSQL to SQLite
Last active July 23, 2023 19:30 — forked from fiftin/Convert PostgreSQL to SQLite
Convert PostgreSQL to SQLite
1. Dump the data only sql to file
$ pg_dump --data-only --inserts YOUR_DB_NAME > dump.sql
2. scp to local
3. Remove the SET statements at the top
such as:
SET statement_timeout = 0;
SET client_encoding = 'SQL_ASCII';
4. Remove the setval sequence queries
$gtk.reset
class TetrisGame
# This is just to get GTK to not complain in the console for now.
def serialize ; { args: '' } ; end
def inspect ; serialize.to_s ; end
def to_s ; serialize.to_s ; end
def render_cube_pixelpos x, y, r, g, b, a=255
@args.outputs.solids << [ x, y, @boxsize, @boxsize, r, g, b, a ]
@megatux
megatux / main.rb
Created June 21, 2023 02:07 — forked from icculus/main.rb
Tetris in DragonRuby, code at the end of Part 2
$gtk.reset
class TetrisGame
def initialize args
@args = args
@next_piece = nil
@next_move = 30
@score = 0
@gameover = false
@grid_w = 10
@megatux
megatux / .editorconfig
Created May 11, 2022 12:18 — forked from JamesMGreene/.editorconfig
Example EditorConfig file
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
@megatux
megatux / s3_folder_upload.rb
Last active January 22, 2021 14:24 — forked from leemour/s3_folder_upload.rb
Upload folder to S3 recursively with ruby, multi threads and aws-sdk v3 gem
# frozen_string_literal: true
require 'rubygems'
require 'aws-sdk'
module S3
# Upload directory recursively to S3
class DirectoryUpload
attr_reader :folder_path, :bucket, :include_folder
attr_accessor :files
@megatux
megatux / .rubocop.yml
Created November 25, 2020 19:28 — forked from jhass/.rubocop.yml
My preferred Rubocop config
require: rubocop-rails
# Commonly used screens these days easily fit more than 80 characters.
Layout/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
Max: 20
@megatux
megatux / i3-cheat-sheet.md
Created February 15, 2019 17:48 — forked from JeffPaine/i3-cheat-sheet.md
i3 Window Manager Cheat Sheet

i3 Window Manager Cheat Sheet

$mod refers to the modifier key (alt by default)

General

  • startx i3 start i3 from command line
  • $mod+<Enter> open a terminal
  • $mod+d open dmenu (text based program launcher)
  • $mod+r resize mode ( or to leave resize mode)
  • $mod+shift+e exit i3
@megatux
megatux / Capybara cheat sheet.md
Last active August 9, 2017 13:29 — forked from zhengjia/capybara cheat sheet
Capybara cheat sheet

Navigating

visit('/projects')
visit(post_comments_path(post))

Inside same page

visit '#footer'
page.execute_script "window.scrollBy(0,500)"

page.execute_script(%Q{$("#scrollElement").prop("scrollTop", 1000000).trigger('scroll')})

@megatux
megatux / dockersetup.MD
Created September 22, 2016 14:16 — forked from diniremix/dockersetup.MD
setup docker on elementary OS freya

instalar docker

instalar una imagen (ubuntu 14.04 en este caso)

  • sudo docker run ubuntu:14.04

revisar las imagenes instaladas

  • sudo docker images

entrar en la imagen recien creada