Skip to content

Instantly share code, notes, and snippets.

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

Abd Rahmane abd1rahmane

🏠
Working from home
  • Chrome browser
View GitHub Profile
@abd1rahmane
abd1rahmane / nodejs-cheatsheet.js
Created September 22, 2020 22:40 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
/* *******************************************************************************************
* GLOBAL CONFIG
* Vue.config is an object containing Vue’s global configurations.
* You can modify its properties listed below before bootstrapping your application.
* https://vuejs.org/v2/api/#Global-Config
* ******************************************************************************************* */
// Configure whether to allow vue-devtools inspection
Vue.config.devtools = true
@abd1rahmane
abd1rahmane / scraping_wizard.py
Last active March 10, 2020 17:54
Scraping Products information using Keyword and catalog | DISCLAIMER. THIS TOOL IS BEING PROVIDED FOR EDUCATIONAL PURPOSES ONLY
import requests
from bs4 import BeautifulSoup
#
import json
from random import choice
"""
DISCLAIMER. THIS TOOL IS BEING PROVIDED
FOR EDUCATIONAL PURPOSES ONLY
@abd1rahmane
abd1rahmane / README.md
Created November 27, 2019 21:53 — forked from shadiakiki1986/README.md
Run a Scrapy spider in a Celery Task (in django)

My first shot at fixing this was in tasks.py file below.

But then that just gave a "unhandled error in deferred", so I went on to use CrawlRunner.

That showed no output at all anymore, and didn't run as expected.

Eventually, I just settled on CELERY_WORKER_MAX_TASKS_PER_CHILD=1=1 in settings.py

Note: CELERY_WORKER_MAX_TASKS_PER_CHILD=1 is for django. Celery without django probably drops the CELERY_ prefix

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="alice">Thanks for trying our documentation. Enjoy!</Say>
<Play>http://demo.twilio.com/docs/classic.mp3</Play>
</Response>
@abd1rahmane
abd1rahmane / blog.md
Created September 20, 2019 13:28 — forked from JacobBennett/blog.md
Clean up your Vue modules with ES6 Arrow Functions

Recently when refactoring a Vue 1.0 application, I utilized ES6 arrow functions to clean up the code and make things a bit more consistent before updating to Vue 2.0. Along the way I made a few mistakes and wanted to share the lessons I learned as well as offer a few conventions that I will be using in my Vue applications moving forward.

The best way to explain this is with an example so lets start there. I'm going to throw a rather large block of code at you here, but stick with me and we will move through it a piece at a time.

<script>

// require vue-resource...

new Vue({
@abd1rahmane
abd1rahmane / bashrestful.py
Created June 17, 2019 21:47
Bash as Rest service (unsecure)
# -*- coding: utf-8 -*-
from flask import Flask
from flask import jsonify, request, render_template
import subprocess
app = Flask(__name__)
@app.route('/bash/run/', methods=['GET'])
def run_script():
@abd1rahmane
abd1rahmane / gist:67df9fa9e3585ae11ee21e87d64bab9b
Created June 8, 2019 10:44 — forked from 345161974/gist:63573abdf1dc9c303d6740fb29496657
Python Code for adding posts to WordPress remotely
import urllib
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods import posts
import xmlrpclib
from wordpress_xmlrpc.compat import xmlrpc_client
from wordpress_xmlrpc.methods import media, posts
import os
########################### Read Me First ###############################
'''
------------------------------------------In DETAIL--------------------------------
is1am
Installing Arch:
sudo vim /etc/pacman.conf
Update packages list: sudo pacman -Syy
run sudo pacman -Syu before installing any software (to update the repositories first)
* Timing issue:
- Change hardware clock to use UTC time:
sudo timedatectl set-local-rtc 0