Skip to content

Instantly share code, notes, and snippets.

View rarous's full-sized avatar
💭
I may be slow to respond.

Aleš Roubíček rarous

💭
I may be slow to respond.
View GitHub Profile
@woloski
woloski / CloudQueueCacheDependency.cs
Created June 27, 2010 00:16
Invalidate ASP.NET Cache using a Windows Azure queue
namespace Southworks.WindowsAzure
{
using System;
using System.Web.Caching;
/// <summary>
/// Represents a cache dependency that uses Windows Azure queues to detect if an item in cache has changed
/// </summary>
/// <remarks>Sending a message a certain queue (specified using the <see cref="CloudQueueCacheDependencyMonitor" />) will invalidate the cache item </remarks>
/// <example>
@rarous
rarous / ControllersInstaller.cs
Last active September 23, 2015 17:08
Minimalistická ukázka integrace Windsor Containeru do webové aplikace
public class ControllersInstaller : IWindsorInstaller {
public void Install(IWindsorContainer container, IConfigurationStore store) {
container.Register(
Classes.
FromThisAssembly().
BasedOn<IController>().
LifestyleTransient(),
Component.
@kolman
kolman / gist:1427422
Created December 3, 2011 15:48
Game of Life rules
module CodeRetreat
open Xunit
type Cell =
| DeadCell of int
| LiveCell of int
let hasChanceToLife (cell:Cell) =
match cell with
'@adent Přesun mailu, na který je odpovídáno, do složky vyřízeno. Testováno v Outlooku 2007.
'Kód v ThisOutlookSession, dirty and cowboy coding compatible VB
Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
Dim replyMail As mailItem
Set myDoneFolder = Application.Session.Folders("Personal Folders").Folders("Vyrizeno")
@maio
maio / gist:2862867
Created June 3, 2012 09:58
Smart semi-colon in Emacs (and Vim)
;; Port of Coderush's smart semi-colon feature to Emacs
;;
;; When I hit semi-colon anywhere, Emacs will move cursor to the end of current
;; line and insert semi-colon (if it's not already there).
;;
;; Idea from last @CoderetreatCZ - HK
(defun maio/electric-semicolon ()
(interactive)
(end-of-line)
@bradwilson
bradwilson / NameTaskReturningMethodAppropriately.cs
Last active December 15, 2015 11:09
FxCop rule to ensure that Task-returning methods are suffixed with 'Async'
using System.Runtime.CompilerServices;
using Microsoft.FxCop.Sdk;
namespace Tier3.FxCop.TaskRules
{
public class NameTaskReturningMethodAppropriately : BaseIntrospectionRule
{
public NameTaskReturningMethodAppropriately() :
base("NameTaskReturningMethodAppropriately",
"Tier3.FxCop.Rules",
@ushu
ushu / S3 buckets copy.md
Created October 29, 2013 16:12
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy
@pbaille
pbaille / midi-parser.clj
Last active April 10, 2020 09:09
midi-parser in Clojure
(ns midi-parser.core
(:use clojure.java.data)
#_(:use utils.utils)
#_(:use vendors.debug-repl)
(:import (java.io File)
#_(java.util Arrays)
#_(java.nio ByteBuffer)
(javax.sound.midi MidiSystem Sequence MidiMessage MidiEvent ShortMessage MetaMessage Track)))
;***************** Utils ********************
(require '[clojure.core.async :as a])
(def xform (comp (map inc)
(filter even?)
(dedupe)
(flatmap range)
(partition-all 3)
(partition-by #(< (apply + %) 7))
(flatmap flatten)
(random-sample 1.0)
@TobiasWooldridge
TobiasWooldridge / gist:22f0cdca75190b9a473f
Last active June 11, 2024 17:30
How to Unbrick a Kindle Paperwhite

How to unbrick an Amazon Kindle Paperwhite™

This guide instructs you in how to unbrick an Amazon Kindle Paperwhite. The consequences of following it are your own responsibility. This method (opening the Kindle and using the serial interface) should be a last resort and should only be considered if other methods fail

The Guide

  1. Pry open Kindle using a prying tool
  2. Unscrew the screen and remove it from the base. Note that there's a screw hidden under the adhesive at the top in the middle
  3. Solder tin wire to serial ports on the bottom
  4. Attach tin wire to USB TTY device (order is ground, RX, TX, from the kindle's perspective, where GND is the smallest pad) and plug USB TTY device into your computer
  5. Open Putty on your computer in serial mode, with the serial port specified as your USB device and baud configured to 115200