Skip to content

Instantly share code, notes, and snippets.

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

Ahmed viztastic

🏠
Working from home
View GitHub Profile
@viztastic
viztastic / timedatectl list-timezones
Created June 26, 2022 04:18 — forked from adamgen/timedatectl list-timezones
An online display timedatectl list-timezones list
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
@viztastic
viztastic / Starting with Git.md
Last active November 2, 2018 02:10
Git Notes

Need to overwrite remote codebase with new git folder.

Git global setup

git config --global user.name "Ahmed"
git config --global user.email "ahmed.dhahbi@gmail.com"

Create a new repository

@viztastic
viztastic / git-commit-prefixes
Created January 3, 2017 08:29 — forked from Marak/git-commit-prefixes
Short list of Git commit prefixes used at Nodejitsu
[api]: New apis / changes to apis
[test]: Update test/* files
[dist]: Changes to submodules, version bumps, updates to package.json
[minor]: Small changes
[doc]: Updates to documentation
[ux]: Updates to UX
[fix]: Bug fixes
[bin]: Update binary scripts associated with the project
[merge]: Resolved git merge from upstream or otherwise
[refactor]: Refactor of existing code with no external API changes
@viztastic
viztastic / EACCESS_Issue.md
Last active December 17, 2016 19:37
Addressing EACCSS issue

Node wasn't letting me install new modules throwing at me an EACCESS: permission denied error every time.

This did it, it can work in other use cases as well, this one lets you install global packages, but you can change the directory to whichever:

$ sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

Bindings

<input type="text" [(ngModel)] = "componentPropertyName" placeholder="name">

The [(ngModel)] basically means that if I update the textbox, it will update the target variable (in this case componentPropertyName) and reflect it back in the screen.

Looping

SysLog

HL

Based on RFC 3164 UDP: 514 (TCP creates unecessary overhead)

Levels

  1. Emergency
  2. Alert
@viztastic
viztastic / Elastic Cheatsheet.md
Last active October 3, 2016 01:38
Quick notes to help me get my head around Elastic stack.

Elasticsearch

Cluster

Cluster Health

GET /_cat/health?v

Indices

Switching from HTTPS to SSH

Suppose you clone in https mode and then decide to switch to SSH:

$ git remote set-url origin git@github.com:{GIT_PROFILE}/{REPO_NAME}.git

@viztastic
viztastic / Docker Logging into Logstash.md
Created October 1, 2016 16:05 — forked from shreyaskarnik/Instructions.md
Route Docker Logs to ELK Stack
  • With Docker 1.8.0 shipped new log-driver for GELF via UDP, this means that the logs from Docker Container(s) can be shipped directly to the ELK stack for further analysis.
  • This tutorial will illustrate how to use the GELF log-driver with Docker engine.
  • Step 1: Setup ELK Stack:
    • docker run -d --name es elasticsearch
    • docker run -d --name logstash --link es:elasticsearch logstash -v /tmp/logstash.conf:/config-dir/logstash.conf logstash logstash -f /config-dir/logstash.conf
    • Note the config for Logstash can be found at this link
    • docker run --link es:elasticsearch -d kibana
  • Once the ELK stack is up now let's fire up our nginx container which ships its logs to ELK stack.
  • LOGSTASH_ADDRESS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' logstash)
  • `docker run -d --net=host --log-driver=gelf --log-opt gelf-address=u

Aggregations

Really should checkout the Elastic Aggregations documentation, it's great:

In short, the format is something like this

  "aggregations" : {
      "<aggregation_name>" : {
 "" : {