Skip to content

Instantly share code, notes, and snippets.

View bogdangrigg's full-sized avatar

Luca-Bogdan Grigorescu bogdangrigg

View GitHub Profile
@darkpssngr
darkpssngr / sso_login_freshdesk.cs
Last active August 25, 2021 09:03 — forked from barryokane/sso_login_freshdesk.cs
SSO Login for Freshdesk support portal - ASP.Net C# Sample Code
static string GetSsoUrl(string baseUrl, string secret, string name, string email) {
var timems = (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds.ToString();
return String.Format("{0}/login/sso?name={1}&email={2}&timestamp={3}&hash={4}",
baseUrl, Server.UrlEncode(name), Server.UrlEncode(email), timems, GetHash(secret, name, email, timems));
}
private static string GetHash(string secret, string name, string email, string timems) {
var input = name + secret + email + timems;
var keybytes = Encoding.UTF8.GetBytes(secret);
var inputBytes = Encoding.UTF8.GetBytes(input);
@CuriousGnu
CuriousGnu / beezid_scraper.py
Created April 3, 2016 14:15
Beezid.com - Auction Scraper
import pycurl
import json
import time
from StringIO import StringIO
i = 0
bnums = []
while True :
print(str(i))
.\Get-SPOAccessToken.ps1
<#
.Synopsis
Sends an HTTP or HTTPS request to a SharePoint Online REST-compliant web service.
.DESCRIPTION
This function sends an HTTP or HTTPS request to a Representational State
Transfer (REST)-compliant ("RESTful") SharePoint Online web service.
.EXAMPLE
Invoke-SPORestMethod -Uri "https://contoso.sharepoint.com/_api/web" -AccessToken $accessToken
@NYKevin
NYKevin / trie.py
Last active December 23, 2015 00:19
A quick-and-dirty Trie implementation
import collections
class Trie(collections.MutableSet):
def __init__(self, iterable=None):
self.children = {}
self.accepting = False
if iterable is not None:
for item in iterable:
self.add(item)
namespace YourNamespace
{
/// <summary>
/// Uses the Name value of the <see cref="ColumnAttribute"/> specified to determine
/// the association between the name of the column in the query results and the member to
/// which it will be extracted. If no column mapping is present all members are mapped as
/// usual.
/// </summary>
/// <typeparam name="T">The type of the object that this association between the mapper applies to.</typeparam>
public class ColumnAttributeTypeMapper<T> : FallbackTypeMapper
@leemars
leemars / sync.sh
Created July 5, 2012 02:50
Git -> SVN sync script
#!/bin/bash
if [[ $# != 1 && $# != 2 ]]
then
echo "$0 <path to git repository> [tree-ish]"
exit 1
fi
msg() {
echo -e -n "\e[32;1m==>\e[0m "
@kellabyte
kellabyte / CQS_and_CQRS.cs
Created March 3, 2012 03:19
CQS_and_CQRS
// CQS (Command-Query Separation)
// Bertrand Meyer devised the CQS principle
// It states that every method should either be a command that performs an action, or a
// query that returns data to the caller, but not both. In other words, asking a question
// should not change the answer. More formally, methods should return a value only if they
// are referentially transparent and hence possess no side effects.
//
// Example:
public class CustomerService