Skip to content

Instantly share code, notes, and snippets.

View MaherSaif's full-sized avatar

Maher Saif MaherSaif

View GitHub Profile
@MaherSaif
MaherSaif / macos-settings.sh
Created December 16, 2020 18:47
macos-settings.sh
#!/bin/bash
# Original script: ~/.osx — http://mths.be/osx
# https://github.com/mathiasbynens/dotfiles
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@MaherSaif
MaherSaif / bootstrap-memo.md
Created September 22, 2020 13:49 — forked from yalab/bootstrap-memo.md
rails5 + webpacker + bootstrap
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add bootstrap@4.0.0-beta jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
Rank Type Prefix/Suffix
1. Prefix my+
2. Suffix +online
3. Prefix the+
4. Suffix +web
5. Suffix +media
6. Prefix web+
7. Suffix +world
8. Suffix +net
9. Prefix go+
@MaherSaif
MaherSaif / Rails-Dockerfile
Last active March 17, 2020 22:12 — forked from siklodi-mariusz/Dockerfile
Dockerfile example for Ruby on Rails running on Alpine Linux
FROM ruby:2.4-alpine3.7
# Install dependencies:
# - build-base: To ensure certain gems can be compiled
# - nodejs: Compile assets
# - postgresql-dev postgresql-client: Communicate with postgres through the postgres gem
# - libxslt-dev libxml2-dev: Nokogiri native dependencies
# - imagemagick: for image processing
RUN apk --update add build-base nodejs tzdata postgresql-dev postgresql-client libxslt-dev libxml2-dev imagemagick
@MaherSaif
MaherSaif / gigabyte_Z370N-i7-8700K-golden-build.txt
Created February 22, 2020 19:15 — forked from AnnoyingTechnology/gigabyte_Z370N-i7-8700K-golden-build.txt
Hackintosh : Gigabyte Z370N + i7-8700K + SSD NVMe + SSD S-ATA
Golden build, i7-8700K iGPU HD630 and dedicated PCIe Wifi+BT.
I put together this build for a friend that has huge iTunes and iPhoto libraries and could not get a Mac with a large enough SSD (Only Mac"Pro" (lol) and iMac"pro" (lol) allow for larger than 1 or 2Tb SSD). Fusion drive was not good enough.
He's very happy with this built, using all of his Apple peripherals as usual (apple watch, ipad, iphone, keyboard, mouse...).
Plus, his computer is faster than a 3500€ iMac. (8e gen Intel core i7 vs 7 gen Inte core i7) + decent cooling solution. + he can add one more NVMe M.2 drive and three more SATA SSDs.
Components : Gigabyte Z370N rev 1.0, i7-8700K, Samsung 970 EVO 1Tb (PCIe), Samsung 860 EVO 2Tb (SATA), PCIe Wifi+BT (BCM946302CS)
0) Prepare the USB drive using the normal procedure

Compare a particular column of 2 different csv files & get the data from second file what is not there in first file

It will fail if it is possible that any data from the first column could end up in any other column or there are any spaces in the data.

Using bash and GNU grep.

grep -v -Ff <(cut -d',' -f 1 file1.csv) file2.csv > file3.csv
var fs = require("fs");
var Github = require("github");
var package = JSON.parse(fs.readFileSync('./package.json'));
var username_password_user_repo = package.repository.url.match(/(?:https?:\/\/|git)(?:([^:@\/]+)(?::([^@]+))?)?@?github.com[:\/]([^:\/.]+)\/([^\/.]+).git$/).slice(1);
var github = new Github({
// required
version: "3.0.0",
// optional
form {
display: flex;
flex-wrap: wrap
}
form > input {
flex: 1 1 10ch;
margin: .5rem
}
form > input[type="email"] {
flex: 3 1 30ch;
@MaherSaif
MaherSaif / gist:72db817f63992b14180eac08ce0b4da4
Created December 5, 2019 14:23 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
DELETE FROM passbook_transactions T1
USING passbook_transactions T2
WHERE T1.ctid > T2.ctid -- delete the "newer" ones
AND T1.source_type = T2.source_type -- list columns that define duplicates
AND T1.source_id = T2.source_id