Skip to content

Instantly share code, notes, and snippets.

@lain0
lain0 / ruby_meta.md
Created September 26, 2023 21:53 — forked from jamesyang124/ruby_meta.md
Ruby meta programming

#!/bin/ruby --verion => 2.0.0-p353

Self

In Ruby, self is a special variable that always references the current object.

  • Inside class or module definition, self refer to the Class or Module object.
  • Inside instance method, self refer to future instance object.
  • Inside class method, self refer to the class.i
@lain0
lain0 / modern_sql_style_guide.md
Created February 1, 2023 12:43 — forked from mattmc3/modern_sql_style_guide.md
Modern SQL Style Guide
layout author title revision version description
default
mattmc3
Modern SQL Style Guide
2019-01-17
1.0.1
A guide to writing clean, clear, and consistent SQL.

Modern SQL Style Guide

@lain0
lain0 / docker.yaml
Created September 10, 2020 13:46 — forked from rbq/docker.yaml
Install Docker CE on Ubuntu using Ansible
---
- hosts: all
tasks:
- name: Install prerequisites for Docker repository
apt:
name: ['apt-transport-https', 'ca-certificates', 'curl', 'gnupg2', 'software-properties-common']
update_cache: yes
- name: Add Docker GPG key
apt_key: url=https://download.docker.com/linux/ubuntu/gpg
@lain0
lain0 / README.md
Created March 31, 2019 12:54 — forked from acamino/README.md
Shortcuts to Improve Your Bash & Zsh Productivity

Shortcut — Action

  • CTRL + A — Move to the beginning of the line
  • CTRL + E — Move to the end of the line
  • CTRL + [left arrow] — Move one word backward (on some systems this is ALT + B)
  • CTRL + [right arrow] — Move one word forward (on some systems this is ALT + F)
  • CTRL + U — (bash) Clear the characters on the line before the current cursor position
  • CTRL + U —(zsh) If you're using the zsh, this will clear the entire line
  • CTRL + K — Clear the characters on the line after the current cursor position
  • ESC + [backspace] — Delete the word in front of the cursor

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0
#!/bin/bash -x
# dw.sh
for i in `seq -w 0 39`;
do
wget https://s3.amazonaws.com/bigmarker-production/271b5fb4af4b708b51b895cd1ee79dfbf8865d58/00$i.jpg
done
@lain0
lain0 / sysctl.conf
Created September 29, 2017 20:12 — forked from kgriffs/sysctl.conf
Linux Web Server Kernel Tuning
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
# Protection from SYN flood attack.
net.ipv4.tcp_syncookies = 1
@lain0
lain0 / gist:48b04f96b6fc3b6cfcce7456c5910936
Last active September 19, 2018 13:50
ruby attr_accessor
```
class Account
attr_accessor :name, :date, :email, :notes
def assign_values(values)
values.each_key do |k|
self.send("#{k}=",values[k])
end
end
docker-compose up -d
Creating network "dockerlamp7_default" with the default driver
Creating volume "dockerlamp7_db" with default driver
Building mysql
Step 1 : FROM mysql:5.7
5.7: Pulling from library/mysql
357ea8c3d80b: Already exists
256a92f57ae8: Pull complete
d5ee0325fe91: Pull complete
a15deb03758b: Pull complete