Skip to content

Instantly share code, notes, and snippets.

View omartrigui's full-sized avatar
🚀
Auf Wiedersehen

Omar Trigui omartrigui

🚀
Auf Wiedersehen
View GitHub Profile
@omartrigui
omartrigui / ngx.cnf
Created June 7, 2018 16:00
Serving static files with Nginx
upstream nodejs {
server localhost:3000;
}
server {
listen 8080;
server_name localhost;
root ~/workspace/test/app;
location / {
@omartrigui
omartrigui / basic_squid3
Created June 7, 2018 13:13 — forked from Shellbye/basic_squid3
squid3 basic authentication
# ref http://stackoverflow.com/questions/3297196/how-to-set-up-a-squid-proxy-with-basic-username-and-password-authentication
# first install apache:
# $ sudo apt-get install -y apache2-utils
# add these five lines to /etc/squid3/squid.conf
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_port 3128 # or whatever you like
@omartrigui
omartrigui / move-git-repository.sh
Created May 18, 2018 01:22
Move a full Git repository
git clone <url to origin repo> temp-dir
git branch -a
git checkout branch-name
git fetch --tags
git tag
git branch -a
git remote rm origin
git remote add origin <url to NEW repo>
git push origin --all
git push --tags
@omartrigui
omartrigui / rkhunter.sh
Created May 10, 2018 20:33
rkhunter setup
# tar -xvf rkhunter-1.4.6.tar.gz
# cd rkhunter-1.4.6
# ./installer.sh --layout default --install
# /usr/local/bin/rkhunter --update
# /usr/local/bin/rkhunter --propupd
# rkhunter --check
@omartrigui
omartrigui / increase-memory
Created April 25, 2018 11:29
Override the default 32MB limit on an in-memory sort - MongoDB
> use admin
> db.adminCommand({setParameter: 1, internalQueryExecMaxBlockingSortBytes:100151432})
@omartrigui
omartrigui / daemonize_nodejs.sh
Last active April 14, 2018 03:53
Daemonize nodejs service using systemd
# vim /etc/systemd/system/myservice.service
[Unit]
Description=myservice-description
After=network.target
[Service]
ExecStart=/opt/myservice-location/src/node/server.js
Restart=always
User=me
Group=group
@omartrigui
omartrigui / exec.sh
Last active July 23, 2018 21:13
Execute non-interpreted binaries with PM2
#!/bin/bash
pm2 start /usr/bin/binary --name instance_name --interpreter none -x -- args
@omartrigui
omartrigui / gist:3a6e761da57b29a6f47d38a44f9d6169
Created March 22, 2018 16:30 — forked from Flet/gist:5447732
Sublime Text: Eclipse Shortcuts keymap
[
{ "keys": ["f12"], "command": "htmlprettify"},
{ "keys": ["f1"], "command": "fold" },
{ "keys": ["f2"], "command": "unfold" },
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
@omartrigui
omartrigui / fonts.sh
Created March 15, 2018 12:31
Install system-wide fonts to Debian based OS
#!/bin/bash
sudo mv ~/path/to/fonts /usr/share/fonts/
sudo fc-cache -f -v
@omartrigui
omartrigui / elasticsearch.sh
Created March 13, 2018 16:22
Fix elasticsearch exited status
# uncomment START_DAEMON=true in /etc/default/elasticsearch