Skip to content

Instantly share code, notes, and snippets.

View azzgo's full-sized avatar
Zen in daily Life

Ishan azzgo

Zen in daily Life
View GitHub Profile
@jonasgeiler
jonasgeiler / Dockerfile
Last active May 10, 2021 15:46
Running local JS Bin using Docker + docker-compose
FROM node:12-alpine
RUN apk --no-cache add git
RUN git clone https://github.com/jsbin/jsbin.git /jsbin
WORKDIR /jsbin
RUN npm install -g grunt-cli
RUN npm install
RUN grunt build
@vishiy
vishiy / AzureMonitorContainers-Metrics-Loganalytics.csv
Last active July 3, 2024 22:49
Gist for metrics collected by Azure monitor for containers
MetricCategory MetricName MetricDimensions MetricType MetricTable MetricNamespace MetricOrigin Comments
Node-CPU cpuAllocatableNanoCores Objectname='K8SNode', Instancename=<nodename> Gauge Perf Amount of cpu that is allocatable by Kubernetes to run pods, expressed in nanocores/nanocpu unit
Node-CPU cpuCapacityNanocores Objectname='K8SNode', Instancename=<nodename> Gauge Perf Total CPU capacity of the node in nanocore/nanocpu unit
Node-CPU cpuUsageNanocores Objectname='K8SNode', Instancename=<nodename> Gauge Perf CPU used by node in nanocore/nanocpu unit
Node-Memory memoryAllocatableBytes Objectname='K8SNode', Instancename=<nodename> Gauge Perf Amount of memory in bytes that is allocatable by kubernetes to run pods
Node-Memory memoryCapacityBytes Objectname='K8SNode', Instancename=<nodename> Gauge Perf Total memory capacity of the node in bytes
Node-Memory memoryRssBytes Objectname='K8SNode', Instancename=<nodename> Gauge Perf Rss memory used by the node in bytes. Collected only for L
# Put this file in /etc/nginx/sites-available
# Then "ln -s /etc/nginx/sites-available/aria2-nginx.conf /etc/nginx/sites-enabled"
# Then "sudo service nginx restart"
server {
listen 80;
listen [::]:80;
root /var/www/aria2; # Put your aria2 web ui here, such as AriaNg
index index.html;
server_name DOMAIN_NAME;
location / {
@TrinityCoder
TrinityCoder / center_text_in_bash.md
Last active April 18, 2024 12:02
How to center text in Bash

Sometimes we might want to print some text in Bash and we might want it to be centered to the centre of the terminal. It is a cheap way how we can increase clarity of output of our script and make it look much more attractive.

The whole magic is hidden in a program called tput.

To get number of rows and cols of current terminal, we need just two simple shell substitutions:

    TERM_ROWS="$(tput rows)"
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active July 23, 2024 12:13
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@kaleksandrov
kaleksandrov / global-protect.sh
Last active July 15, 2024 11:57
Simple script that starts and stops GlobalProtect.app on Mac OSX.
#!/bin/bash
case $# in
0)
echo "Usage: $0 {start|stop}"
exit 1
;;
1)
case $1 in
start)
@tonysneed
tonysneed / Mac OS X: Open in Visual Studio Code
Last active June 14, 2024 04:16
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@pwlin
pwlin / gist:8a0d01e6428b7a96e2eb
Last active July 20, 2024 17:34
Android : add cert to system store
https://code.google.com/p/android/issues/detail?id=32696#c5
If you have a certificate that is not
trusted by Android, when you add it, it goes in the personal cert store.
When you add a cert in this personal cert store, the system requires a
higher security level to unlock the device. But if you manage to add your
cert to the system store then you don't have this requirement. Obviously,
root is required to add a certificate to the system store, but it is quiet
easy.
@lambdahands
lambdahands / _readme.md
Created September 28, 2015 17:09
FlowType and CSS Modules

Huh?

So basically FlowType doesn't know about CSS Modules, a really handy way of dealing with the plagues of CSS in codebases (global variables and dependency wackiness mainly).

What WebPack allows us to do is "require" CSS files and use their class names:

import styles from "my_styles.css";
import React from "react";
@anguyen8
anguyen8 / git_push
Created May 11, 2015 19:20
GitPush with checking for updates
function gpush () {
# Check if we need to pull before pushing
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
BASE=$(git merge-base @ @{u})
stop=0
if [ $LOCAL = $REMOTE ]; then
echo "Up-to-date"