Skip to content

Instantly share code, notes, and snippets.

View khaledadrani's full-sized avatar
💭
Doing stuff

Khaled Adrani khaledadrani

💭
Doing stuff
View GitHub Profile
@MartinThoma
MartinThoma / gist:19704f1a499b27fc9afc192f86798098
Created February 16, 2020 12:18
Installing scipy for pypy
Collecting scipy
Using cached scipy-1.4.1.tar.gz (24.6 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /home/moose/.pyenv/versions/pypy3.6-7.3.0/bin/python /home/moose/.pyenv/versions/pypy3.6-7.3.0/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-1x4wi_xk/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- wheel setuptools 'Cython>=0.29.13' 'numpy==1.13.3; python_version=='"'"'3.5'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.5'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"
@bradtraversy
bradtraversy / django_crash_course.MD
Last active March 1, 2024 02:44
Commands for Django 2.x Crash Course

Django Crash Course Commands

# Install pipenv
pip install pipenv
# Create Venv
pipenv shell
import pandas as pd
import requests, re, datetime, urllib.parse
from bs4 import BeautifulSoup as bs
from multiprocessing.pool import ThreadPool
def get_datelist():
base_time = datetime.datetime.today()
base_time = base_time.replace(hour=0, second=0, minute=0, microsecond=0)
date_list = [base_time + datetime.timedelta(days=x) for x in range(1, 15)]
@simonthompson99
simonthompson99 / alembic.py
Last active January 17, 2023 11:04
[Alembic Cheatsheet] Some basic commands for Alembic #python #database #alembic
# initiate alembic in project
alembic init alembic
#####################################
# need to edit alembic/env.py so that gets connection string from settings/local_config python module
# add in below around about line 17
# add parent project to sys path
import sys, os
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@zcaceres
zcaceres / node-python-fastai.md
Last active May 16, 2023 07:20
Starter code to use NodeJS with a Python layer for the model.

Deploying a Deep Learning Image Classification Model with NodeJS, Python, and Fastai

TL|DR: Use this to easily deploy a FastAI Python model using NodeJS.

You've processed your data and trained your model and now it's time to move it to the cloud.

If you've used a Python-based framework like fastai to build your model, there are several excellent solutions for deployment like Django or Starlette. But many web devs prefer to work in NodeJS, especially if your model is only part of a broader application.

My friend Navjot pointed out that NodeJS and Python could run together if we could send remote procedure calls from NodeJS to Python.

@mrk-han
mrk-han / gist:4a8d59a3b7a3eb7883cb804632e6640f
Last active April 7, 2021 20:36
A rough documentation of setting up MERN environment on a Fresh Centos 7 Server on Digital Ocean

Context

Reverse Proxy?

Or just use Node

  • We had the opportunity of setting up a fresh Digital Ocean server running CentOS 7, and opt'd for this for simplicity and for the fun experience of learning how to set up a fresh CentOS 7 Server to be used with the MERN stack.
  • In our scenario, Node can listen on port 80 and we should be good to go...
@AO8
AO8 / crawler.py
Last active May 23, 2023 09:12
Crawl a website and gather all internal links with Python and BeautifulSoup.
# Adapted from example in Ch.3 of "Web Scraping With Python, Second Edition" by Ryan Mitchell
import re
import requests
from bs4 import BeautifulSoup
pages = set()
def get_links(page_url):
global pages
@onjin
onjin / docker-compose.yml
Created September 5, 2016 09:17
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active May 6, 2024 14:31
Vanilla JavaScript Quick Reference / Cheatsheet