Skip to content

Instantly share code, notes, and snippets.

View khchine5's full-sized avatar
🗺️
World citizen

Hamza Khchine khchine5

🗺️
World citizen
View GitHub Profile
@x-yuri
x-yuri / docker + supercronic.md
Last active March 23, 2024 23:02
docker + supercronic

docker + [supercronic][a]

Use [-debug][d] to make it more verbose.

docker-compose.yml:

services:
  supercronic:
 build: .

Python Modules for Scraping:

Scraping and Parsing

  • selectolax
  • AdvancedHTMLParser
  • grequests
  • parsel
  • mechanicalsoup
  • beautifulsoup4
@victorono
victorono / remove_duplicates.py
Last active April 26, 2024 17:57
Django - remove duplicate objects where there is more than one field to compare
from django.db.models import Count, Max
unique_fields = ['field_1', 'field_2']
duplicates = (
MyModel.objects.values(*unique_fields)
.order_by()
.annotate(max_id=Max('id'), count_id=Count('id'))
.filter(count_id__gt=1)
)
@ryanc-me
ryanc-me / odoo.conf
Last active September 26, 2020 22:51
Sample Odoo/Nginx Config (with dbfilter_from_header support)
# Author: Ryan Cole
# Website: https://ryanc.me
# GitHub: https://github.com/MGinshe
# Usage:
# Place this file in /etc/nginx/sites-enabled/
# Make sure you edit the DOMAIN_HERE and SSL_CERTIFICATE, and DB_FILTER sections
#
# Note: This config file is designed to be used with the Odoo dbfilter_from_header module
# https://apps.openerp.com/apps/modules/9.0/dbfilter_from_header/
@broilogabriel
broilogabriel / Docker.md
Last active March 24, 2023 11:07
Just to remember some Docker commands
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active June 1, 2024 11:27
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@khchine5
khchine5 / Virtualenv with Python3
Last active January 22, 2016 04:25
Installing and using virtualenv with Python3
Update the server
$ apt-get update
Install pip3
$ sudo apt-get install pip3
Install virtualenv via pip
$ pip3 install virtualenv
Create a virtualenvs directory