Skip to content

Instantly share code, notes, and snippets.

View bbl's full-sized avatar

Bogdan bbl

View GitHub Profile
@marcogoldin
marcogoldin / bootstrap_style_dash_data_table.py
Last active November 28, 2022 15:30
Dash DataTable Bootstrap style
import dash_html_components as html
import dash_table
import pandas as pd
def data_table(df):
table = html.Div(
className='table table-responsive-md p-3',
children=dash_table.DataTable(
id='tabella-milano',
@alexanderkjeldaas
alexanderkjeldaas / setup-k3s-on-hetzner.sh
Last active January 10, 2024 19:07
Setup k3s on Hetzner with CSI drivers
#!/bin/bash
LOCATION=${HCLOUD_LOCATION:-nbg1-dc3}
if [ -z "$HCLOUD_TOKEN" ]; then
echo "You need to set HCLOUD_TOKEN to an Hetzner API token!";
exit 1
fi
if [ -z "$SSH_KEY" ]; then
@maxivak
maxivak / date_time_picker_rails.md
Last active March 7, 2022 19:36
Datetime picker in Rails app

Date time picker in Rails app

There are several options to make Date input in Rails application:

  • Default inputs from simple_form
  • HTML 5 date input
  • Text input with jQuery UI Date time picker
  • Other plugins for date input with Bootstrap 4
@EvGe22
EvGe22 / tensorflow_installation.md
Last active March 26, 2018 13:59
Installing Tensorflow 1.6 with CUDA 9.0 with cudnn 7.0 on Ubuntu 16.04 x86_64 | Anaconda
@dmytrotkk
dmytrotkk / rails_lib_services.md
Created November 14, 2017 13:07
Rails app: Organizing `lib` directory with static services

Organizing lib directory with static services

base_service.rb
    module Core end

    module Core::BaseService
 extend self
@dmytrotkk
dmytrotkk / rails_error_handling.md
Created November 8, 2017 14:42
Handling errors in Rails with ActiveSupport

Handling errors in Rails with ActiveSupport

Rails provide a clean way to rescue exceptions in a controller with a defined method.

Let's suppose that you have a class with method create that could raise ActiveRecord::RecordInvalid exception:

class ExampleController < ApplicationController

    def create
@dmytrotkk
dmytrotkk / RunAProxyOnAmazonEC2VPC.md
Created August 28, 2017 20:15 — forked from webinista/RunAProxyOnAmazonEC2VPC.md
Create a proxy server on an Amazon EC2 (VPC) instance

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
  • Select Create a new security group.
@maxivak
maxivak / readme.md
Last active April 11, 2023 15:08
Restore repo from Gitlab bundle file

Gitlab exports repositories to tar archive which contains .bundle files.

We have repo.bundle file and we want to restore files from it.

  • create bare repo from bundle file
git clone --mirror myrepo.bundle my.git
@maxivak
maxivak / ubuntu16_rename_eth.md
Last active October 17, 2017 08:26
Rename interface to eth0 on Ubuntu 16.04

Fix interface to 'eth0'

for ubuntu 16.04:

sudo sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1 net.ifnames=0\"/" /etc/default/grub 
sudo update-grub2
  • reboot
@negz
negz / kubedump.sh
Last active July 1, 2024 20:16
Dump Kubernetes cluster resources as YAML
#!/usr/bin/env bash
set -e
CONTEXT="$1"
if [[ -z ${CONTEXT} ]]; then
echo "Usage: $0 KUBE-CONTEXT"
exit 1
fi