Skip to content

Instantly share code, notes, and snippets.

import socket
import threading
#this program sits in the middle between a client and a server
# it should listen to data from the client
#detect dos
#and send it to server
# todo!
@eeddaann
eeddaann / dos_.idea_.name
Created February 20, 2014 07:16
our project
dos

add scrollbar to firefox RESTClient

this gist guides how to adds a scrollbar to the following addon: (or any other css patching in firefox) https://addons.mozilla.org/en-US/firefox/addon/restclient/

  • go to about:support on firefox
  • choose Show Folder
  • look for chrome folder, if it is not exist, add folder and call it chrome
  • inside chrome folder, look for userContent.css add these lines or create file with this name and paste there:
.dropdown-menu.savedRequest{
@eeddaann
eeddaann / README.md
Last active October 3, 2017 18:09
read stdout from hanging command

dealing with hanging bash process

This line is helpful when you only need a keypress to continue the hangging process: echo dummy_text | COMMAND

When you want to wait for specific pattern from stream and exit: bash -c 'cat <(COMMAND & grep -m 1 PATTERN)'

When you want to wait for 3 seconds and exit: bash -c 'cat &lt;(COMMAND &amp; sleep 3s)'

@eeddaann
eeddaann / sir_python
Last active July 14, 2021 22:12
sir model with age groups implemented in python
#!/usr/bin/env python
import numpy as np
from pylab import *
import scipy.integrate as spi
#Parameter Values
PopIn= {'g1s_young':1/12,'g1i_young':1/12,'g1r_young':1/12,'g1s_mid':1/12,'g1i_mid':1/12,'g1r_mid':1/12,'g1s_old':1/12,'g1i_old':1/12,'g1r_old':1/12,'g1s_vold':1/12,'g1i_vold':1/12,'g1r_vold':1/12}
arr = [1/12]*12
beta= 0.50
@eeddaann
eeddaann / Grafana templating for docker service.md
Last active November 7, 2017 14:29
this gist help with creating grafana templating from docker swarm services

configure templating for docker service

  • create new variable with type Query and name it as you wish
  • under Query Options:
    • Query: container_tasks_state{state="running",container_label_com_docker_swarm_service_name=~".*_logstash"}
    • Regex: /.container_label_com_docker_swarm_service_name="(.)",container_label_com_docker_swarm_task_id=/

it will create variables for any service which ends with "logstash"

@eeddaann
eeddaann / Odometry.md
Last active November 13, 2017 22:13
Odometry - estimate errors

Odometry - estimate errors

  • N - Encoder resolution
  • r - Wheel radius
  • b - distance between wheels

The following equations are applied:

$$teta = 2*u/b u = 2*pi*r/n$$
@eeddaann
eeddaann / PromQL-docker-swarm-node-name.md
Last active March 2, 2021 14:11
query in PromQL to get docker swarm node names instead of node id

PromQL

Prometheus is a time-series db, it's query language called PromQL.

Here are some analogies from SQL which may help to understand the basics of PromQL better:

  • metric ~ sql table
  • label ~ sql column

example:

  • Count how many containers running on each node:

Largest Files Windows

The following command show the 20 largest files on C:\ drive:

 dir c:\ -recurse -erroraction silentlycontinue | sort length -descending | select -first 20