Skip to content

Instantly share code, notes, and snippets.

View albarki's full-sized avatar
😁

Ibrahim Mohamed albarki

😁
View GitHub Profile
pipeline {
agent any
stages {
stage('Prepare') {
steps {
sh 'composer install'
sh 'rm -rf build/api'
sh 'rm -rf build/coverage'
sh 'rm -rf build/logs'
@mgedmin
mgedmin / gist:9547214
Created March 14, 2014 12:59
Setting up a Jenkins slave on Linux
# This is how you add a Jenkins slave
# On master:
sudo -u jenkins -H ssh-keygen
# On slave
adduser --system --group --home=/var/lib/jenkins-slave --no-create-home --disabled-password --quiet --shell /bin/bash jenkins-slave
install -d -o jenkins-slave -g jenkins-slave /var/lib/jenkins-slave
@mkhuda
mkhuda / sidekiq.service
Last active June 28, 2022 23:15
Sidekiq service auto start for Ubuntu 16.04 using Systemd
#
# Sidekiq auto start using systemd unit file for Ubuntu 16.04
#
# Put this in /lib/systemd/system (Ubuntu).
# Run:
# 1. systemctl enable sidekiq (to enable sidekiq service)
# 2. systemctl {start,stop,restart} sidekiq (to start sidekiq service)
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
@junaidk
junaidk / ec2.sh
Last active July 7, 2023 04:55
Get List of EC2 instances from All regions
# install aws cli first and configure it with credentials and default region
# the script will iterate over all regions of AWS
for region in `aws ec2 describe-regions --output text | cut -f4`
do
echo -e "\nListing Instances in region:'$region'..."
aws ec2 describe-instances --query "Reservations[*].Instances[*].{IP:PublicIpAddress,ID:InstanceId,Type:InstanceType,State:State.Name,Name:Tags[0].Value}" --output=table --region $region
done
@drkarl
drkarl / gist:739a864b3275e901d317
Last active October 17, 2023 10:43
Ask HN: Best Linux server backup system?

Linux Backup Solutions

I've been looking for the best Linux backup system, and also reading lots of HN comments.

Instead of putting pros and cons of every backup system I'll just list some deal-breakers which would disqualify them.

Also I would like that you, the HN community, would add more deal breakers for these or other backup systems if you know some more and at the same time, if you have data to disprove some of the deal-breakers listed here (benchmarks, info about something being true for older releases but is fixed on newer releases), please share it so that I can edit this list accordingly.

  • It has a lot of management overhead and that's a problem if you don't have time for a full time backup administrator.
@bvolpato
bvolpato / ba.sh
Last active February 6, 2024 09:00
Install Chrome Driver with Xvfb (Ubuntu Server)
#!/bin/bash
# Chrome Repo
sudo apt-get install fonts-liberation xdg-utils libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
sudo apt-get update
# Download
@houtianze
houtianze / sysv.init.script.to.systemd.unit.file.md
Last active February 20, 2024 14:00
Convert SysV Init scripts to Systemd Unit File

Let's say you have a SysV Init Script named foo

  1. Copy the file to /etc/init.d/foo

  2. Enable the SysV service: chkconfig --add foo

  3. Enable the SysV service: chkconfig foo on

  4. Start the service: service foo start. After this, systemd-sysv-generator will generate this file /run/systemd/generator.late/foo.service, copy this file to /etc/systemd/system by running: cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service

  5. Edit /etc/systemd/system/foo.service by running systemctl edit foo.service, add in the following line to foo.servie (this makes the service installable)

[Install]

@tinkertims
tinkertims / install_byobu_on_centos7.sh
Last active February 26, 2024 05:44
Install byobu to CentOS 7
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -ivh epel-release-7-5.noarch.rpm
sudo yum install byobu -y --enablerepo=epel-testing
@mattratleph
mattratleph / vimdiff.md
Last active March 27, 2024 10:04 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@Kartones
Kartones / postgres-cheatsheet.md
Last active March 27, 2024 12:38
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)