Skip to content

Instantly share code, notes, and snippets.

View ahmad-moussawi's full-sized avatar
🎹
Playing 🎶

Ahmad Moussawi ahmad-moussawi

🎹
Playing 🎶
View GitHub Profile
@ahmad-moussawi
ahmad-moussawi / sftp-ubuntu.md
Created March 8, 2022 14:25 — forked from lymanlai/sftp-ubuntu.md
Basic tutorial for creating a SFTP-only user on Ubuntu 9.04 and greater

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h

@ahmad-moussawi
ahmad-moussawi / dacpac_change_schema.sh
Created December 23, 2021 14:47
A shell script that change the schema of the SQL Server DACPAC file
#!/bin/bash
# This uitlity help to convert a dacpac from one schema to another
# taking into consideration some edge cases like when converting from/to dbo
# it assumes that you have 7-zip installed
in=${1:?Select dacpac file, usage: $0 <file>.dacpac <target_schema>}
schema=${2:?schema cannot be empty, usage: $0 <file>.dacpac <target_schema>}
# zip command
zip="/c/Program\\ Files/7-Zip/7z.exe"
@ahmad-moussawi
ahmad-moussawi / what_is_sso.md
Created November 23, 2021 11:29
What is SSO?

What is SSO

Terminology

  • SSO : Single Sign On
  • IdP : Identity Provider (Azure Ad, Okta, Auth0, JumpCloud, etc ...)
  • SP : Service Provider (TreasuryXpress, Outlook.com, Jira.com, etc ...)
  • SAML : Security Assertion Markup Language
  • ADFS : Active Directory Federation Service
@ahmad-moussawi
ahmad-moussawi / CSharpErrorsAndWarnings.md
Created September 25, 2020 10:22 — forked from thomaslevesque/CSharpErrorsAndWarnings.md
All C# errors and warnings. Generated by the code in this repo: https://github.com/thomaslevesque/GenerateCSharpErrors. Last updated 2019/06/14, Roslyn commit d5b8d64b4d840b26c947abd2a00b1070cbee55f0.

All C# errors and warnings

Parsed from the Roslyn source code using Roslyn.

Code Severity Message
CS0006 Error Metadata file '{0}' could not be found
CS0009 Fatal Metadata file '{0}' could not be opened -- {1}
CS0012 Error The type '{0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{1}'.
CS0016 Error Could not write to output file '{0}' -- '{1}'
@ahmad-moussawi
ahmad-moussawi / tree_list_conversion.js
Created March 3, 2020 13:08
Tree <--> List conversion
function createTree(list) {
var map = {}, node, roots = [], i;
for (i = 0; i < list.length; i += 1) {
map[list[i].id] = i; // initialize the map
list[i].children = []; // initialize the children
}
for (i = 0; i < list.length; i += 1) {
Afghanistan (+93)
Albania (+355)
Algeria (+213)
American Samoa (+1)
Andorra (+376)
Angola (+244)
Anguilla (+1)
Antarctica (+672)
Antigua and Barbuda (+1)
Argentina (+54)
@ahmad-moussawi
ahmad-moussawi / CompilingCSharpCode.cs
Created January 29, 2020 08:40 — forked from RickStrahl/CompilingCSharpCode.cs
A few different approaches to dynamically execute C# code dynamically at runtime from a string of code.
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Scripting;
using Microsoft.CodeAnalysis.Scripting;
using Mono.CSharp;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.Dynamic;
using System.Linq;
@ahmad-moussawi
ahmad-moussawi / group_where_conditions
Last active April 2, 2019 20:00
sqlkata_tips_tricks.sql
SELECT * FROM [Books]
WHERE ([Status] = 'active' AND [AuthorId] IS NOT NULL)
OR ([IsPublished] = 1 AND [PublishedDate] IS NOT NULL)
name code currency_code timezone
Afghanistan AF AFN Asia/Kabul
Åland Islands AX FIM Europe/Mariehamn
Albania AL ALL Europe/Tirane
Algeria DZ DZD Africa/Algiers
American Samoa AS USD Pacific/Pago_Pago
Andorra AD EUR Europe/Andorra
Angola AO AOA Africa/Luanda
Anguilla AI XCD America/Anguilla
Antarctica AQ AUD Antarctica/McMurdo
@ahmad-moussawi
ahmad-moussawi / webapi_with_sqlkata.sh
Created January 30, 2019 21:56
Web Api with SqlKata
dotnet new mvc -o WebApiDemo