Skip to content

Instantly share code, notes, and snippets.

View MohammedEssehemy's full-sized avatar
👀
Exploring

Essehemy MohammedEssehemy

👀
Exploring
View GitHub Profile
@MohammedEssehemy
MohammedEssehemy / class-type.d.ts
Last active April 2, 2022 11:37
typescript utils
export type ClassType<T> = new () => T;
@MohammedEssehemy
MohammedEssehemy / largestFiles.py
Created October 22, 2020 11:33 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#
@MohammedEssehemy
MohammedEssehemy / Jenkinsfile.groovy
Created May 20, 2019 17:45 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@MohammedEssehemy
MohammedEssehemy / gitlab-registry.gc.sh
Created March 19, 2019 16:03 — forked from eedugon/gitlab-registry.gc.sh
Manual garbage collector for gitlab registry, it removes old revisions that are not referenced by any tag
#!/bin/bash
# This is a modification of gitlab-gc.sh script created by Peter Bábics (pbabics/gitlab-gc.sh)
# Improvements
# - Searching in all BASE_PATH, not fixing the search to a depth of 2
# - Directories without valid tags or revisions directories won't be processed (to avoid unexpected issues)
# - Logging in case there's nothing to delete
# - running registry-garbage-collect only when something has been deleted
#!/bin/bash

# update ubuntu server
sudo apt-get update

# upgrade ubuntu server
sudo apt-get upgrade

# install curl, make, g++ and git
@MohammedEssehemy
MohammedEssehemy / Dockerfile
Created January 5, 2019 12:02
node with canvas and pdfjs #node #canvas #pdfjs
FROM node:10-alpine
LABEL maintainer="Mohammed Essehemy <mohammedessehemy@gmail.com>"
WORKDIR /source
COPY package.json .
# .npm-deps https://github.com/Automattic/node-canvas/issues/866
RUN apk add --no-cache --virtual .build-deps git build-base g++ && \
apk add --no-cache cairo-dev libjpeg-turbo-dev pango-dev && \
@MohammedEssehemy
MohammedEssehemy / Dockerfile
Created January 5, 2019 12:01
node with phantomJs #node #phantomjs #docker
# Switch Node images to non-alpine as PhantomJS doesn't run on Alpine
FROM node:10-jessie-slim
LABEL maintainer="Mohammed Essehemy <mohammedessehemy@gmail.com>"
ENV BUILD_PACKAGES="curl build-essential g++ flex bison gperf ruby perl \
libssl-dev libpng-dev libjpeg-dev python \
libx11-dev libxext-dev libsqlite3-dev \
libicu-dev libfreetype6"
ENV RUN_PACKAGES="libfontconfig"
@MohammedEssehemy
MohammedEssehemy / Dockerfile
Created January 5, 2019 11:59
meteor with unoconv docker file #meteor #unoconv #docker
FROM node:8.12-stretch as build-stage
LABEL maintainer="Mohammed Essehemy <mohammedessehemy@gmail.com>"
ENV METEOR_ALLOW_SUPERUSER=true
WORKDIR /source
ADD ./ /source/
RUN curl https://install.meteor.com/ | sh && \
@MohammedEssehemy
MohammedEssehemy / NTFS_MAC.md
Last active December 6, 2018 02:57
Read NTFS USB on MAC

Read NTFS USB on MAC

  1. Copy device label REPLCAE SPACE WITH \040
  2. Open terminal
  3. sudo nano /etc/fstab
  4. Add the following line.
       LABEL=LABEL_FROM_1 none ntfs nobrowse,rw
    
  5. Remove device and insert it again
# credits: https://serverfault.com/a/426429/452807
PRIVKEY=id_rsa
TESTKEY=id_rsa.pub
diff <( ssh-keygen -y -e -f "$PRIVKEY" ) <( ssh-keygen -y -e -f "$TESTKEY" )