Skip to content

Instantly share code, notes, and snippets.

View sabuein's full-sized avatar
🏠
Working from home

Salaheddin AbuEin sabuein

🏠
Working from home
View GitHub Profile
def tableu_simplex(num_constraints, num_dec_variables, obj_func_coefficients, lhs_values, rhs_values):
#fixed_variables = list(range(num_dec_variables))
rhs_values.append(0)
rhs_values = np.array(rhs_values, dtype = np.float64)
cj_row = np.array(obj_func_coefficients + [0] * num_constraints)
#print("cj_row:", cj_row)
num_columns = num_constraints + num_dec_variables
row_table = []
@CC1119
CC1119 / enterprise_token.rb
Last active May 10, 2025 05:16 — forked from markasoftware/enterprise_token.rb
OpenProject Enterprise mode for free
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ it doesn't show that enterprise mode is enabled in the settings, but all ################
############ enterprise mode features, such as KanBan boards, are enabled. ################
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
@WebReflection
WebReflection / esx.md
Last active October 6, 2024 12:35
Proposal: an ESX for JS implementation
// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open('app').then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
@markasoftware
markasoftware / enterprise_token.rb
Last active June 26, 2025 13:53
OpenProject Enterprise mode for free
############ If you are using DOCKER all-in-one image, create Dockerfile like: ################
############ FROM openproject/openproject:16 ################
############ COPY ./enterprise_token.rb app/models/enterprise_token.rb ################
############ If you are runing a manual installation: ################
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ If using some other set up (eg docker-compose), read the comments on ################
############ https://gist.github.com/markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 ################
@jsnelders
jsnelders / wordpress_export_to_json.php
Last active November 15, 2024 14:16
Export all core WordPress data (posts, pages, attachments, comments, tags, categories and users) to a JSON formatted file.
<?php
/**
* Plugin Name: WordPress Export to JSON
* Plugin URI: https://jsnelders.com/
* Description: Export all WordPress posts, pages, comments, tags, commments and users to a JSON file.
* Author: Jason Snelders
* Author URI: http://jsnelders.com
* Version: 2020-01-30.1
**/
@harrisonmalone
harrisonmalone / _form-validation.md
Last active July 4, 2023 22:23
form validation and events lecture for m0119

Lecture ✍️

JS Events

So far we have mostly been using HTML buttons to trigger JS functions, but this is only one event we can use to trigger logic from our JS files. In previous tasks we set up what is called an event listener to detect when the button was clicked. We passed a callback as a function that gets called when event is triggered. Being able to pass functions as parameters - the same way as we can with variables - is one of the major strengths of the JS language.

Event-based programming can be a little tricky to wrap your head around, especially as a beginner. Up until now you have probably been mainly programming in a sequential or imperative way - each line is executed one after another. When we introduce event listeners and callbacks we are determining the functionality we want to happen but we are not actually in control of when this functionality happens - functions aren't called until the button is actually clicked by the user.

Let's create a Coder Academy webapp that allows users t

@qti3e
qti3e / README.md
Last active June 6, 2025 15:36
List of file signatures and mime types based on file extensions
@leommoore
leommoore / file_magic_numbers.md
Last active June 22, 2025 06:03
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

@PatrickDinh
PatrickDinh / SqlTableToHtml.md
Last active February 23, 2025 14:24
Convert SQL Server table to HTML

For our reporting services, we need to convert a lot SQL tables to HTML. This is the SP that can convert any table to HTML based on a SP created by Ian Atkin ([email protected]) The original post can be found here

The modified version supports converting tables having NULL cells & better styling

create PROCEDURE [dbo].[SqlTableToHtml] (
@TABLENAME  NVARCHAR(500),
@OUTPUT   NVARCHAR(MAX) OUTPUT,
@TBL_STYLE NVARCHAR(1024) = '',
@TD_STYLE NVARCHAR(1024) = '',