Skip to content

Instantly share code, notes, and snippets.

@jclement
jclement / tarsnap_with_pushover.py
Last active August 6, 2021 03:37
Quick and lazy script to backup data via Tarsnap, automatically prune old backups, and push errors / success to devices via Pushover.
#!/usr/bin/env python
import httplib, urllib
import subprocess
import time
import socket
# Configuration #########################################################
BACKUP_PREFIX=socket.gethostname() + "_"
MAX_BACKUPS=30
@jclement
jclement / 4seg.cpp
Created December 26, 2020 23:06
Silly random 4 segment display thing for Arduino
#include <Arduino.h>
#include <TM1637Display.h>
#define CLK 2
#define DIO 3
TM1637Display display(CLK, DIO);
void setup()
{
display.setBrightness(100);
}
@jclement
jclement / robotize.py
Created September 27, 2012 21:48
Robotize Google Contact Photos
#!/usr/bin/env python
# ============================================================
# Configuration file: ~/.gdata
# [gdata]
# user: user@gmail.com
# password: password or per-app password
# ============================================================
import sys
@jclement
jclement / service.config
Last active March 22, 2018 16:13
Testing public facing AFE Nav service
<!-- ================================================= -->
<!-- THIS FILE IS AUTOGENERATED. DO NOT MODIFY THIS FILE -->
<!-- ================================================= -->
<castle>
<?define DISABLE_TLS ?>
<properties>
<!-- Service Configuration -->
<servicePort>0</servicePort>
<serviceHost>localhost</serviceHost>
<webServicePort>9081</webServicePort>
/* ============================================================================================ */
/* Delete all stored procs, views, funcs and tables from a SQL Server database */
/* Adapted from: http://blog.kashyapmakadia.com/2009/08/drop-everything-in-sql-server-2005.html */
/* ============================================================================================ */
DECLARE @name VARCHAR(128)
DECLARE @constraint VARCHAR(254)
DECLARE @SQL VARCHAR(254)
/* Drop all non-system stored procs */
@jclement
jclement / tfs_history_dumper.cs
Created August 8, 2017 14:59
Quick script to dump TFS check-in history to CSV for further analysis
/* ========= NUGET PACKAGES ==============================================================
Id Versions ProjectName
-- -------- -----------
CsvHelper {2.16.3.0} TFSHistoryDumper
Microsoft.AspNet.WebApi.Client {5.2.2} TFSHistoryDumper
Microsoft.AspNet.WebApi.Core {
@jclement
jclement / guid.sql
Created March 28, 2016 15:28
Generate a GUID in form "1ce9b033-d9fa-452a-8767-970fb0548eb4" from Oracle
select lower(regexp_replace(rawtohex(sys_guid()), '([A-F0-9]{8})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{12})', '\1-\2-\3-\4-\5')) from dual
@jclement
jclement / gist:076a95c94bb52e61c407
Created February 23, 2016 16:57 — forked from thomseddon/gist:4703968
Auto Expanding/Grow textarea directive for AngularJS
/**
* The MIT License (MIT)
*
* Copyright (c) 2013 Thom Seddon
* Copyright (c) 2010 Google
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@jclement
jclement / AESGCM.cs
Created February 21, 2016 00:47 — forked from jbtule/AESGCM.cs
I have two code examples that I wrote for best practices encrypting a string in c#. They are both using authenticated encryption. http://stackoverflow.com/a/10366194/637783
/*
* This work (Modern Encryption of a String C#, by James Tuley),
* identified by James Tuley, is free of known copyright restrictions.
* https://gist.github.com/4336842
* http://creativecommons.org/publicdomain/mark/1.0/
*/
using System;
using System.IO;
using System.Text;
#include "Arduino.h"
#include <Adafruit_NeoPixel.h>
#define PIN 4
#define LED_COUNT 60
// Create an instance of the Adafruit_NeoPixel class called "leds".
// That'll be what we refer to from here on...
Adafruit_NeoPixel leds = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_GRB + NEO_KHZ800);