Skip to content

Instantly share code, notes, and snippets.

View ishahid's full-sized avatar

Imran Shahid ishahid

View GitHub Profile
@shacker
shacker / gist:87908e13c9ee6655ce90
Last active October 5, 2023 17:46
Using the Workday API with Python and the suds client library
import sys
from suds import client
from suds.wsse import Security, UsernameToken
from suds.sax.text import Raw
from suds.sudsobject import asdict
from suds import WebFault
'''
Given a Workday Employee_ID, returns the last name of that employee.
@tbrianjones
tbrianjones / free_email_provider_domains.txt
Last active April 9, 2024 21:36
A list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
126.com
150ml.com
15meg4free.com
@ishahid
ishahid / Hash.cs
Last active December 13, 2015 17:38 — forked from inogo/Hashes.cs
MD5 and SHA1 hash calculation tool.
using System;
using System.Text;
using System.Security.Cryptography;
static class Hash
{
public static string SHA1(string text)
{
byte[] buffer = Encoding.UTF8.GetBytes(text);
var sha1 = new SHA1CryptoServiceProvider();
@xeoncross
xeoncross / gitstats.sh
Created November 5, 2012 21:35
Git - calculate how many lines of code were added/changed by someone
# Run this in the project repo from the command-line
# http://stackoverflow.com/a/4593065/99923
git log --shortstat --author "Xeoncross" --since "2 weeks ago" --until "1 week ago" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@hrldcpr
hrldcpr / tree.md
Last active April 15, 2024 15:27
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@tufanbarisyildirim
tufanbarisyildirim / sort_array_multidim.php
Created September 15, 2011 23:26
sort a multidimensional array by sql like order by clause
<?php
/**
* @name Mutlidimensional Array Sorter.
* @author Tufan Barış YILDIRIM
* @link http://www.tufanbarisyildirim.com
* @github http://github.com/tufanbarisyildirim
*
* This function can be used for sorting a multidimensional array by sql like order by clause
*
* @param mixed $array
def attach_foreignkey(objects, field, select_related=None):
"""
Shortcut method which handles a pythonic LEFT OUTER JOIN.
``attach_foreignkey(posts, Post.thread)``
"""
field = field.field
qs = field.rel.to.objects.filter(pk__in=distinct(getattr(o, field.column) for o in objects))
if select_related:
qs = qs.select_related(*select_related)
class QuerySetDoubleIteration(Exception):
"A QuerySet was iterated over twice, you probably want to list() it."
pass
# "Skinny" here means we use iterator by default, rather than
# ballooning in memory.
class SkinnyManager(Manager):
def get_query_set(self):
return SkinnyQuerySet(self.model, using=self._db)
anonymous
anonymous / SQLyogTunnel.php
Created May 23, 2010 00:50
<?php
/*
SQLyog
Copyright 2003-2006, Webyog
http://www.webyog.com
HTTP Tunneling Page
This page exposes the MySQL API as a set of web-services which is consumed by SQLyog - the most popular GUI to MySQL.