Skip to content

Instantly share code, notes, and snippets.

View mahmoudajawad's full-sized avatar
👨‍💻
Building awesome stuff!

Mahmoud Abduljawad mahmoudajawad

👨‍💻
Building awesome stuff!
View GitHub Profile
@mahmoudajawad
mahmoudajawad / falcon_40b_instruct_chat.py
Created June 18, 2023 15:55
Run falcon-40b-instruct in conversational mode
import torch
import transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
model = "tiiuae/falcon-40b-instruct"
tokenizer = AutoTokenizer.from_pretrained(model, padding_side="left")
pipeline = transformers.pipeline(
@mahmoudajawad
mahmoudajawad / update_package.tns-ng10.js
Last active September 19, 2020 18:36
Node script to update NativeScript+Angular projects to Angular 10
/*
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
from functools import wraps, lru_cache
from contextlib import contextmanager
class _SkipCache(Exception):
def __init__(self, value):
self.value = value
class _CachedFunction(object):
def __init__(self, maxsize = 128, typed = False):
self.__is_skipped = False
@LayZeeDK
LayZeeDK / web-application-horizontal-layers.csv
Last active January 19, 2023 11:57
Horizontal layers of a web application.
Horizontal layer Examples
Business logic Application-specific logic, domain logic, validation rules
Persistence WebStorage, IndexedDB, File System Access API, HTTP, WebSocket, GraphQL, Firebase, Meteor
Messaging WebRTC, WebSocket, Push API, Server-Sent Events
I/O Web Bluetooth, WebUSB, NFC, camera, microphone, proximity sensor, ambient light sensor
Presentation DOM manipulation, event listeners, formatting
User interaction UI behaviour, form validation
State management Application state management, application-specific events
@djangosporti
djangosporti / fix.wkhtmltopdf.odoo.snippetbucket.erp.open.source.seo.sh
Created June 19, 2017 00:57 — forked from tejastank/fix.wkhtmltopdf.odoo.snippetbucket.erp.open.source.seo.sh
Wkhtmltopdf failed (error code: -6). Message: The switch --header-spacing, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display.
How to Fix it:
1. Remove wkhtmltopdf and related package
$ sudo apt-get remove libqt4-dev qt4-dev-tools wkhtmltopdf
$ sudo apt-get autoremove
2. Install requirement package for compiling
$ sudo apt-get install openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
@pikhovkin
pikhovkin / weasyprint_complex_headers.py
Last active February 3, 2024 17:04
Repeat on each page of complex headers (eg, tables) except the first page
# coding: utf-8
from weasyprint import HTML, CSS
def get_page_body(boxes):
for box in boxes:
if box.element_tag == 'body':
return box