Skip to content

Instantly share code, notes, and snippets.

@sasajib
sasajib / gitlab-docker-compose.yml
Created March 2, 2022 18:49 — forked from boiyama/docker-compose.yml
docker-compose.yml configuring GitLab with Container Registry, Pages, CI, Mattermost (enabled WebRTC), and some other options
version: '2'
services:
gitlab:
container_name: gitlab
image: gitlab/gitlab-ce:latest
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
## GitLab configuration settings
##! Check out the latest version of this file to know about the different
@sasajib
sasajib / gist:9a0b2a45b182d7a6f96f9fcdca790613
Created January 16, 2022 06:58 — forked from Axxon/gist:c150339eba06dd5cd8ec8b9e2904e40e
Fix append_path message (add fn in /etc/profile.d/perlbin.sh)
append_path()
{
case ":$PATH:" in
*:"$1":*)
;;
*)
PATH="${PATH:+$PATH:}$1"
esac
}
@sasajib
sasajib / git-branch-rename.sh
Last active August 23, 2024 13:52 — forked from grimzy/git-pull-all
Git rename local and remote branch
#!/usr/bin/env sh
# usage git-branch-rename.sh <oldName> <newName>
# make code up to date
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@sasajib
sasajib / nginx-tuning.md
Created January 17, 2021 11:11 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@sasajib
sasajib / bucket-policies-primer.md
Created August 17, 2020 09:33 — forked from krishnasrinivas/bucket-policies-primer.md
Explanation of bucket polices by example

Bucket Policy

Bucket policy is an access policy available for you to grant anonymous permissions to your Minio resources. Bucket policy uses JSON-based access policy language.

This section presents a few examples of typical use cases for bucket policies. The policies use testbucket strings in the resource value. To test these policies, you need to replace these strings with your bucket name. For more information please read Amazon S3 access policy language

Granting Read-Only Permission to an Anonymous User

The following example policy grants the s3:GetObject permission to any public anonymous users. This permission allows anyone to read the object data under testbucket, which is useful for when you have publicly readable assets. A typical example is a website assets stored in testbucket.

@sasajib
sasajib / create-thumbnails
Created April 7, 2020 02:17 — forked from johnnyg/create-thumbnails
Generate thumbnails and output media info
#!/bin/bash
parse_time() {
IFS=' ' read -ra PART <<< "$1"
seconds=0
for i in "${PART[@]}"; do
number=$(expr match $i '\([0-9]\+\)')
unit=$(expr match $i '[0-9]*\([a-z]\+\)')
case $unit in
h)
@sasajib
sasajib / LEPP.md
Created March 10, 2020 07:52 — forked from cham11ng/LEPP.md
LEPP Setup - Ubuntu 16.04 LTS

A Relatively Secure Server Stack Setup in Ubuntu 16.04 LTS

Anup Dhakal

Sagar Chamling

Introduction

In this guide, LEPP stands for Linux, Nginx (pronounced as Engine-X) , Postgres and PHP (PHP Hypertext Preprocessor).

@sasajib
sasajib / clean-up-boot-partition-ubuntu.md
Created October 16, 2018 22:24 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@sasajib
sasajib / loop_aria2.sh
Created December 21, 2017 20:57 — forked from jonbakerfish/loop_aria2.sh
aria2 downloads a list of files, loop until all file are finished
#!/bin/bash
aria2c -j5 -i list.txt -c --save-session out.txt
has_error=`wc -l < out.txt`
while [ $has_error -gt 0 ]
do
echo "still has $has_error errors, rerun aria2 to download ..."
aria2c -j5 -i list.txt -c --save-session out.txt
has_error=`wc -l < out.txt`
sleep 10
@sasajib
sasajib / run.sh
Created May 19, 2017 22:15 — forked from jakub300/run.sh
Compile headless shell (Chromium)
# Based on:
# http://www.zackarychapple.guru/chrome/2016/08/24/chrome-headless.html
# https://www.chromium.org/developers/how-tos/get-the-code
# https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
apt-get update
apt-get install -y curl git htop man unzip vim wget python
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PATH:`pwd`/depot_tools
mkdir Chromium && cd Chromium