Skip to content

Instantly share code, notes, and snippets.

@weshouman
weshouman / openstack_study.md
Last active March 15, 2024 09:51
Openstack study topics

Rapid dive resource

  • Take a look at this list, it has the namings clearly stated within a multi-part guide for setting up openstack, alongside with the system requirements.

Component Documentation

General Introduction resources

For basic understanding of the functionality, following are some useful resources.

  • OpenStack's demo videos, is a good collection for different videos.
@weshouman
weshouman / ansible_advanced.md
Last active March 1, 2020 14:27
Debugging Ansible tips

Debugging Options

To debug (using print statements), one has 2 options

Debug the Module

  • The module files are located inside ansible/module_utils/module_name/ ie: ansible/module_utils/k8s/
  • The parameters given to a specific task are stored in the self.params
  • self.params gets the values assigned outside the module (from the Module System)
  • Adding any print statements, will result in the task failing, so after debugging ensure no prints are still existent

Debug the Module System

@weshouman
weshouman / molecule_hints.md
Last active April 2, 2020 03:56
Advanced molecule hints

SETUP

I recommend having a virtualenv for testing.

  • Follow this video for a how to create an ansible role (with the molecule structure included)
  • We have multiple ways for testing the roles, docker is the most preferred for the speed of development.
  • Assuming you are starting fresh, use molecule init role --role-name my-role --driver-name docker or molecule init role my-role --driver-name docker to initiate the role. Otherwise use the same command on another directory with the same --role-name and copy the molecule dir and the .yamllint file.
  • Following this hint, if you use a virtualenv add its directory to the ignore list in the .yamllint by adding
ignore: |
@weshouman
weshouman / generic-commands.md
Last active August 10, 2020 19:34
Useful commands to debug a Kubernetes cluster

kubectl config view -o json: Get the currently kubeconfig info

@weshouman
weshouman / vnc_on_hypriotos.md
Last active September 15, 2019 03:09
Enabling VNC on Hypriot OS

DISCLAIMER: This gist is a WIP, as moving forward after logging in to the machine itself doesn't work so far.

To enable VNC for rpi connected through SSH, do the following steps

Enable VNC from Raspberry Configuration

  • Update the dependencies, To ensure next installation would work
    sudo apt update
  • Open Raspberry's configuration
@weshouman
weshouman / kubernetes_on_hypriot.md
Last active September 29, 2019 16:37
My steps to install kubernetes on hypriot

Change the hostname

The issue: The hostname persists after restarts due to the cloud.cfg file which has a default option of persisting the black-pearl as the hostname.
The solution: To specify a different hostname for each rpi I had for each rpi to use:
sudo sed -i '/preserve_hostname: false/c\preserve_hostname: true' /etc/cloud/cloud.cfg && sudo hostnamectl set-hostname black-pearl_1
..
sudo sed -i '/preserve_hostname: false/c\preserve_hostname: true' /etc/cloud/cloud.cfg && sudo hostnamectl set-hostname black-pearl_n

Note: setting the preserve_hostname to true again will reset the hostname to black-pearl.

Change to a static ip address

@weshouman
weshouman / vscode_settings.md
Last active June 30, 2021 18:54
VS Code Settings ttricks

Pylint doesn't parse the sys.append("path") by default, following this workround we can append .\src path or any other path into pylint.

My vscode settings.json file includes

    "python.linting.pylintArgs": [
        "--init-hook",
        "import sys; sys.path.insert(0, './src')",
        "--indent-string=\"  \"",
@weshouman
weshouman / guide.md
Created March 15, 2019 06:01
socket programming in c

Tutorial

A C tutorial that has a basic server and client.

Debugging

Non localhost traffic only

  • Wireshark

All traffic

  • Windows: use wincap (has an interactive interface)
@weshouman
weshouman / xdotool.md
Created March 12, 2019 21:43
linux_productivity_hints

We can operate on the current window either by

xdotool windowsize $(xdotool getactivewindow) 100% 50%

or

xdotool getwindowfocus windowsize 100% 50%

The second way is better as it works even when we try to span a new shell

@weshouman
weshouman / left_outer_join_guide.sql
Last active February 25, 2018 22:29
left outer join progression #mysql
/*
Use the left outer join to grap some info about each employee and the names of the employees that are managed by him, if they exist.
Following are steps which get more specific over the steps.
*/
# Step 1:
select *
from employee natural left outer join manages;
# Step 2: use on instead of natural to achieve the manager equality to employee