Skip to content

Instantly share code, notes, and snippets.

View OsamaShabrez's full-sized avatar
💭
Turning ☕ and 🍕 into software 🤓

Osama Shabrez OsamaShabrez

💭
Turning ☕ and 🍕 into software 🤓
View GitHub Profile
// https://github.com/AutoMapper/AutoMapper/issues/3834
public static class AutoMapperExtensions
{
public static IMappingExpression<TSource, TDestination> MapRecordMember<TSource, TDestination, TMember>(
this IMappingExpression<TSource, TDestination> mappingExpression,
Expression<Func<TDestination, TMember>> destinationMember, Expression<Func<TSource, TMember>> sourceMember)
{
var memberInfo = ReflectionHelper.FindProperty(destinationMember);
string memberName = memberInfo.Name;
@OsamaShabrez
OsamaShabrez / disable.sh
Created February 17, 2020 21:58
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
@OsamaShabrez
OsamaShabrez / clean-up-boot-partition-ubuntu.md
Created November 27, 2019 09:36 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

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

Reference

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

1. Check the current kernel version

$ uname -r 
@OsamaShabrez
OsamaShabrez / clean_unused_kernels
Created November 27, 2019 08:32 — forked from rugbyprof/clean_unused_kernels
Ubuntu Cleanup: How to Remove All Unused Linux Kernel Headers, Images and Modules
//Credit goes to - http://ubuntugenius.wordpress.com
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
sudo python3.6 setup.py develop
[sudo] password for osama:
Sorry, try again.
[sudo] password for osama:
running develop
running egg_info
writing mapnik.egg-info/PKG-INFO
writing dependency_links to mapnik.egg-info/dependency_links.txt
writing top-level names to mapnik.egg-info/top_level.txt
reading manifest file 'mapnik.egg-info/SOURCES.txt'
@OsamaShabrez
OsamaShabrez / countries-with-iso.sql
Last active November 10, 2023 18:01
SQL Query to create a Countries table and insert all countries with their ISO
CREATE TABLE `Countries` (
`ID` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`NAME` CHAR(100) NOT NULL UNIQUE,
`ISO` CHAR(2) NOT NULL UNIQUE
);
INSERT INTO Countries (Name, ISO) VALUES ('Afghanistan', 'AF');
INSERT INTO Countries (Name, ISO) VALUES ('Albania', 'AL');
INSERT INTO Countries (Name, ISO) VALUES ('Algeria', 'DZ');
INSERT INTO Countries (Name, ISO) VALUES ('American Samoa', 'AS');
INSERT INTO Countries (Name, ISO) VALUES ('Andorra', 'AD');
@OsamaShabrez
OsamaShabrez / bash_aliases
Created August 3, 2018 13:41
Install PHP7.1 + Nginx + MySQL on macOS Sierra
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.restart='nginx.stop && nginx.start'
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.restart='php-fpm.stop && php-fpm.start'
alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.restart='mysql.stop && mysql.start'
@OsamaShabrez
OsamaShabrez / autoexec.cfg
Created June 17, 2017 15:50
CSGO Config File
// Rates
rate "307200"
cl_cmdrate "128"
cl_updaterate "128"
cl_interp "0.0"
cl_interp_ratio "1"
cl_interpolate "1"
cl_lagcompensation "1"
net_client_steamdatagram_enable_override "1" // SDR beta
@OsamaShabrez
OsamaShabrez / gpg-agent.conf
Created September 22, 2016 13:23
GPG Config
pinentry-program /usr/local/bin/pinentry-mac

Keybase proof

I hereby claim:

  • I am osamashabrez on github.
  • I am osamashabrez (https://keybase.io/osamashabrez) on keybase.
  • I have a public key ASBw7263VVpHDxYQSzZb2x3rFrV0_RdN113wegCira0whgo

To claim this, I am signing this object: