Skip to content

Instantly share code, notes, and snippets.

Avatar

Samir Sabri hopewise

View GitHub Profile
View gist:95db9d666c81e676307f86bd296d484a
For NGINX:
Show analysis of access.log file
goaccess -f /var/log/nginx/access.log --log-format='%h %^[%d:%t %^] "%r" %s %b"%R" "%u" "%f" "%T" "%T" "%T" ' --date-format=%d/%b/%Y --time-format=%T
Show analysis of specific route:
tail -25000 /var/log/nginx/access.log.1 | grep /webhooks | goaccess --log-format='%h %^[%d:%t %^] "%r" %s %b"%R" "%u" "%f" "%T" "%T" "%T" ' --date-format=%d/%b/%Y --time-format=%T
For specific time: >= 5PM <= 8PM, date 12/Jul/2020
@hopewise
hopewise / install Taurus
Created May 1, 2020
Install Taurus at Ubuntu
View install Taurus
#install python3.5
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
cd /usr/src
wget https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tgz
sudo wget https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tgz
sudo tar xzf Python-3.5.6.tgz
cd Python-3.5.6
sudo ./configure --enable-optimizations
sudo make altinstall
@hopewise
hopewise / test.rb
Created Oct 27, 2019
New Year Chaos, I don't know why it fails at case: `1 2 5 3 7 8 6 4` ?
View test.rb
#!/bin/ruby
require 'json'
require 'stringio'
# Complete the minimumBribes function below.
def minimumBribes(q)
too = false
bs = 0
@hopewise
hopewise / build.gradle
Created Jun 24, 2019
Build gradle without signing info to be used with MS App Center
View build.gradle
repositories {
maven { url 'https://raw.github.com/applanga/sdk-android/master/maven/releases/' }
maven { url 'https://jitpack.io' }
}
buildscript {
repositories {
jcenter()
google()
maven {
@hopewise
hopewise / gist:0ac6a48b3502a42554ca5ba61dd258df
Created Mar 25, 2019
Extract all screen titles in sketch.cloud
View gist:0ac6a48b3502a42554ca5ba61dd258df
#might need to change selector..
for (var i=0; i< $$(".sc-gacfCG").length; i++) console.log(i, $$(".sc-gacfCG")[i].textContent);
@hopewise
hopewise / copy_folder.rb
Created Feb 27, 2019
ruby method to copy from a folder to another folder within the same bucket
View copy_folder.rb
tested with `gem 'aws-sdk', '~> 2'`
```
@s3 = Aws::S3::Client.new(
region: ENV['AWS_REGION'],
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_KEY']
)
@hopewise
hopewise / gist:59c8e48f73484a1c85f24a58ab78fb9a
Created Jul 5, 2018
Manual installation for module in Odoo
View gist:59c8e48f73484a1c85f24a58ab78fb9a
#start odoo container for the first time
docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres:9.4
docker run -p 8069:8069 -it --name odoo --link db:db -t odoo
#bash into odoo as root
docker exec -i -t -u 0 odoo /bin/bash
#download module and extract it at local file system
#copy module to odoo modules directory
View gist:82f4c26868e52a5c3a3b4053400609a9
docker run -p 4011:4011 -p 4033:4033 -v /Users/samir/Documents/projects/elixir:/usr/src -it elixir:1.5.2 bash
@hopewise
hopewise / .babelrc
Last active Aug 16, 2018
React JS , mobx , GraphQL , apollo client, webpack-dev-server writes file to desk, load .graphql files separately
View .babelrc
{
"presets": [
"react",
"es2015",
"stage-1"
],
"plugins": ["transform-decorators-legacy", "transform-class-properties", "inline-import-graphql-ast"]
}
@hopewise
hopewise / gist:7bfdd80e9e9a0e2fe4ea95866fec3a0c
Last active May 28, 2018
force python3 in terminal, this is important to make sure AWS eb deploy uses git to deploy
View gist:7bfdd80e9e9a0e2fe4ea95866fec3a0c
#to let eb use python3
export PATH=/Users/Apple/Library/Python/3.4/bin:$PATH
You can’t perform that action at this time.