Skip to content

Instantly share code, notes, and snippets.

View clickhouse-get-tables-size.sql
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@rocLv
rocLv / receiver-demo.html
Created Sep 17, 2021 — forked from GitSquared/receiver-demo.html
Use your browser to access a remote terminal.
View receiver-demo.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Remote terminal</title>
<link rel="stylesheet" href="xterm.css" />
<script src="terminal.class.js"></script>
@rocLv
rocLv / HowToOpenAnotherTerminal-BashInstanceInARunningDockerContainer.md How To Open Another Terminal/Bash Instance In A Running Docker Container #gistblog #bash #docker
View HowToOpenAnotherTerminal-BashInstanceInARunningDockerContainer.md

How To Open Another Terminal/Bash Instance In A Running Docker Container

Add the following to your bashrc.

#Add another docker window
function dock()
{
  if [ "$1" == "-h" ]
 then
View rails_generator_cheat_sheet.md

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

@rocLv
rocLv / install_sentry.sh
Created Feb 25, 2019 — forked from bjmc/install_sentry.sh
Basic setup script for installing Sentry (http://getsentry.com) + Redis on new Ubuntu 14.04 Amazon EC2 instance
View install_sentry.sh
#! /bin/bash
export RUN_AS='ubuntu';
export INSTALL_DIR='/var/www/sentry';
HOSTNAME='http://mysentry.example.com'; # No trailing slash
DB_HOST='something.rds.amazonaws.com';
DB_PORT='5432';
DB_USER='sentry';
DB_NAME='sentry';
DB_PASSWORD='DB_PASSWORD';
@rocLv
rocLv / rails.ipynb.json
Created Apr 25, 2018 — forked from l15n/rails.ipynb.json
Rails and Jupyter
View rails.ipynb.json
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
View gist:9c99516d6225a8c3b305c0d7c8d180b5

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@rocLv
rocLv / beautiful_idiomatic_python.md
Created Nov 11, 2017 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!
View beautiful_idiomatic_python.md

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
View application.rb
require_relative 'boot'
require 'csv'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Giant
class Application < Rails::Application
View json_helper.rb
module RequestHelper
def json_response
JSON.parse(response.body, symbolize_names: true)
end
end
class ActionDispatch::IntegrationTest
include RequestHelper
end