Skip to content

Instantly share code, notes, and snippets.

View Tes3awy's full-sized avatar
👨‍💻
Focusing

Osama Abbas Tes3awy

👨‍💻
Focusing
View GitHub Profile
@ktbyers
ktbyers / threading_csv.py
Created February 24, 2017 20:10
Netmiko Threading from a CSV file
import csv
import threading
from Queue import Queue
from getpass import getpass
from netmiko import ConnectHandler
from datetime import datetime
USER = 'pyclass'
PASSWORD = getpass()
@tachyondecay
tachyondecay / models.py
Last active July 7, 2024 09:00
Tags in Flask via SQLalchemy and association proxies
from app import db
from sqlalchemy import desc, event, func, orm
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy_utils import ArrowType, auto_delete_orphans
from slugify import slugify_unicode
tags = db.Table('tag_associations',
db.Column('tag_id', db.Integer, db.ForeignKey('tags.id')),
db.Column('article_id', db.Integer, db.ForeignKey('articles.id')))
/*
* Extends ColorThief plugin to mark the most intense color in a palette.
*
* var colorThief = new ColorThief();
* var palette = colorThief.getPalette(image, 5);
* var palette = colorThief.markBoomColors(palette);
*
* It ranks all colors in a palette according to the sum of saturation and color value (HSV) descending.
* The palette colors will be extended with boomRank and boomColor.
* boomColor is set to true if the color is the most intense color in the given palette.
@alexanderfefelov
alexanderfefelov / gist:df3c562ea2e42438c940
Created August 29, 2014 06:41
How to configure a Cisco Catalyst switch to act as a DHCP relay agent with option 82
  +-------------+
  |             |
  | DHCP server |
  |             |
  +-------------+
          | 192.168.1.34
          |
          |
   VLAN 1 | 192.168.1.12

+------[1]----+

@debojitkakoti
debojitkakoti / api.php
Created January 28, 2014 10:14
Simple API in PHP to return data in JSON format
<?php
include_once 'db.php';
global $con;
define('ERROR','404');//Define Your Error message HERE
define('REQADDR', '127.0.0.1');//Define your REQUESTIN SERVER ADDR
if($_SERVER['REMOTE_ADDR']=='127.0.0.1'){
//process it
if(isset($_GET['q'])){
$q=mysql_real_escape_string($_GET['q']);//TO get rid of SQL Enjection