Skip to content

Instantly share code, notes, and snippets.

View mpcabd's full-sized avatar
🇵🇸

Abdullah Diab mpcabd

🇵🇸
View GitHub Profile
@mpcabd
mpcabd / linkedin-accept.js
Last active June 3, 2024 08:04
Bulk Accepting LinkedIn Connections
/*
One day I received over a thousand connection requests, so naturally I didn't click the accept button manually.
Run the code below in your JS Console on https://www.linkedin.com/mynetwork/invite-connect/connections/
Copyright 2024 Abdullah Diab
@mpcabd
mpcabd / speedup.js
Last active December 21, 2017 14:17
Speed up all media on page
function getAllMedia() {
var getDocuments = function () {
var f = function (document) {
var iframes = Array.from(document.getElementsByTagName('iframe'));
var result = [ document ];
iframes.forEach(function (iframe) {
var iframeDocument;
try {
iframeDocument = iframe.contentDocument;
} catch (error) {
@mpcabd
mpcabd / python-mac-set-html-clipboard.py
Created June 1, 2017 15:40
Python3 - Set Mac clipboard with HTML content
import subprocess
html = '<p><strong>Hello</strong> <em>Bob</em> <code>How</code> are you!</p>'
p_hex = subprocess.Popen(
('hexdump', '-ve', '1/1 "%.2x"'),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE
)
p_hex_output = p_hex.communicate(html.encode('utf-8'))[0]
@mpcabd
mpcabd / curlp.pl
Last active April 9, 2024 22:11
curl with Proxy auto-config (PAC) files
#!/usr/bin/env perl
# This work is licensed under the GNU Public License (GPLv3).
# To view a copy of this license, visit http://www.gnu.org/copyleft/gpl.html
# To read more about this script go to: http://mpcabd.xyz/using-curl-with-proxy-pac-configuration-files/
use strict;
use warnings;
@mpcabd
mpcabd / models.py
Last active June 21, 2021 20:17
Archived models in Django 1.4.x
from django.db import models
class MyModelBase(models.Model):
class Meta:
abstract = True
field1 = models.CharField(max_length=256)
field2 = models.BooleanField(db_index=True, default=True)
#....
@mpcabd
mpcabd / pattern_image.py
Created January 14, 2013 11:11
Code for http://mpcabd.igeex.biz/get-pattern-from-an-image-in-pil-python/ Getting a pattern from an image in PIL (Python)
def get_pattern_from_image(file_name, pattern_width, pattern_height):
import Image
pattern_image = Image.open(file_name, 'r')
result_image = Image.new('RGB', (pattern_width, pattern_height))
x = 0
while x < pattern_width:
y = 0
while y < pattern_height:
result_image.paste(pattern_image, (x, y))
y += pattern_image.size[1]
# This work is licensed under the GNU Public License (GPL).
# To view a copy of this license, visit http://www.gnu.org/copyleft/gpl.html
# For more information visit this blog post http://mpcabd.igeex.biz/python-celery-asynchronous-task-decorator/
# Written by Abd Allah Diab (mpcabd)
# Email: mpcabd ^at^ gmail ^dot^ com
# Website: http://mpcabd.igeex.biz
from django.utils.decorators import available_attrs