Skip to content

Instantly share code, notes, and snippets.

@jclement
jclement / chunkerizer.cs
Last active October 11, 2015 20:28
Code for splitting long messages into chunks giving preference for keeping lines together
using System;
using System.Collections.Generic;
namespace Chunkerizer
{
public delegate string ChunkHeaderGenerator(int chunkIndex);
/// <summary>
///
/// _________________.---.______
@jclement
jclement / _vimrc
Created December 1, 2012 15:22
_vimrc to load additional vimrc / plugins from another folder
let &runtimepath.=',$HOME/My Documents/GitHub/dotfiles/vim/'
source $HOME/My Documents/GitHub/dotfiles/vimrc
@jclement
jclement / gist:4220241
Created December 5, 2012 22:53
Return latest folder in a directory
@echo off
for /f "delims=" %%x in ('dir /od /b \\server\dir\*.*') do set recent=%%x
echo %recent%
@jclement
jclement / vimrc
Created December 6, 2012 17:58
Snippets from vimrc to checkout/diff files with TFS command line client
" Helpers for TFS integration
map <F5> :silent !tf checkout %<CR><CR>
map <C-F5> :silent !tf diff %<CR><CR>
'Outlook VB Macro to move selected mail item(s) to a target folder
Sub MoveToArchive()
On Error Resume Next
Dim ns As Outlook.NameSpace
Dim moveToFolder As Outlook.MAPIFolder
Dim objItem As Object
Set ns = Application.GetNamespace("MAPI")
@jclement
jclement / gist:4479168
Created January 7, 2013 22:34
Helper code to push Crystal Reports folder into Environment to help with periodic startup issues
static void SetCrystalPath()
{
string crpath;
if (Environment.Is64BitProcess)
{
crpath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64";
}
else
{
crpath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86";
@jclement
jclement / segment.py
Last active December 12, 2015 01:49
Quick little algorithm to chop up an array into an array of contiguous ranges.
samples=[
# =======================================
# input, expected result pairs
# =======================================
# empty list
([], []),
# single digit
([1], [(1,1)]),
# basic range
([1,2,3], [(1,3)]),
@jclement
jclement / morse.ino
Last active December 14, 2015 04:59
Blink a message in Morse Code with an Arduino
/*
************************************************************************
Blink out a message in morse code
************************************************************************
*/
const int led = 13;
const char* message = "HELLO WORLD";
const int letter_unit_delay = 500;
@jclement
jclement / gpgqr.py
Created April 29, 2013 20:54
Crappy code to split a GPG key in 3 giant QR codes
#!/usr/bin/env python
import os
import sys
LINE_COUNT =40
def dumpLines(basename, segment, lines):
fn ='%s_%02d.png' % (basename, segment)
print fn
f = os.popen("qrencode -o \"%s\" " % fn,'w')
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Web;
using System.Text;