Skip to content

Instantly share code, notes, and snippets.

@ajax0
ajax0 / Automating Outlook.py
Last active February 29, 2024 08:48
Automating Outlook.py
import win32com.client, datetime
from datetime import date
from dateutil.parser import *
import calendar
import pandas as pd
# Step 1, block 1 : access Outlook and get the events from the calendar
Outlook = win32com.client.Dispatch("Outlook.Application")
ns = Outlook.GetNamespace("MAPI")
appts = ns.GetDefaultFolder(9).Items
@mpj
mpj / SocketServer.java
Created May 3, 2015 08:12
Java/Node socket client interaction
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
public class SocketServer {
public static final int port = 12345;
private ServerSocket server;
public void listen() {
@ajtowf
ajtowf / Global.asax
Created January 7, 2014 12:55
WebApi2 config with OAuth setup
public class MvcApplication : HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
@azat-co
azat-co / express.js
Last active August 19, 2018 03:30
Tutorial: REST API with Node.js and MongoDB using Mongoskin and Express.js
var express = require('express')
, mongoskin = require('mongoskin')
var app = express()
app.use(express.bodyParser())
var db = mongoskin.db('localhost:27017/test', {safe:true});
app.param('collectionName', function(req, res, next, collectionName){
req.collection = db.collection(collectionName)
@st3phan
st3phan / phantom.js
Created December 4, 2012 09:37
Creating screenshots of HTML elements using PhantomJS
var page = require('webpage').create();
page.open('/url', function () {
var items = ['selector1', 'selector2', 'selector3'];
var items_length = items.length;
for (var i = 0; i < items_length; i++) {
var clipRect = page.evaluate(function (s) {
var cr = document.querySelector(s).getBoundingClientRect();
return cr;
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

var UserModel = function () {
var self = this;
// Somewhat sophisticated loading flag that supports parallel loading of multiple endpoints.
self.loading = ko.observableArray();
// Encapsulating the entire form in a property, so we can use ko.mapping in a safe way.
// If properties were directly on the model, we'd have to re-init model every time we
// load data, which could lead to unwanted consequences.
self.user = ko.observable();
@bsodmike
bsodmike / plupload_FilesAdded.js
Created November 16, 2011 12:50
Remove files from the plupload file 'Queue'
uploader.bind('FilesAdded', function(up, files) {
//console.log (up);
//console.log (files);
$.each(files, function(i, file) {
$('#filelist').append(
'<div id="' + file.id + '">' +
file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
'<a href="" class="remove btn error">X</a></div>'
);
$('#uploadfiles').css('display', 'initial');
@dallonf
dallonf / index.html
Created October 14, 2011 14:38
Facebook Photo Selector with Knockout.js
<!DOCTYPE html>
<html>
<head>
<title>Knockout Demo</title>
<script type="text/javascript" src="jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="jquery.tmpl.js"></script>
<script type="text/javascript" src="knockout.js"></script>
<style type="text/css">
.selected {
border: #FFFF00 3px solid;