Skip to content

Instantly share code, notes, and snippets.

View tomash's full-sized avatar

Tomasz Stachewicz tomash

View GitHub Profile
@tomash
tomash / Gemfile
Last active August 13, 2024 13:49
Ebook renamer to "title - author.epub" (and associated mobi file if present)
# frozen_string_literal: true
source "https://rubygems.org"
# https://kitaitimakoto.gitlab.io/epub-parser/file.Home.html
gem "epub-parser"
@tomash
tomash / enable_dark_mode.bat
Created March 12, 2022 14:24
One-click enable or disable Dark Mode in Windows 10
powershell.exe New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force; New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force
/*
* IRremoteESP8266: IRrecvDump - dump details of IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 Sept, 2015
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
* LG added by Darryl Smith (based on the JVC protocol)
*/
#include <IRremoteESP8266.h>
/*
* IRremoteESP8266: IRrecvDump - dump details of IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 Sept, 2015
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
* LG added by Darryl Smith (based on the JVC protocol)
*/
#include <IRremoteESP8266.h>
@tomash
tomash / Configuration.h
Created May 5, 2020 14:25
Marlin 2.0.5.2 config for Ender 3 with SKR Mini E3 v1.3 at Jelinka Rebased office
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@tomash
tomash / dropper_bottle_holder.js
Created December 19, 2019 22:50
customizable dropper bottle holder ported to OpenJSCad
// title : Customizable Dropper Bottle Holder
// author : Jean Philippe Neumann, Tomasz Stachewicz
// license : Creative Commons Attribution-ShareAlike 3.0 Unported License
// see http://creativecommons.org/licenses/by-sa/3.0/
// URL : http://www.thingiverse.com/thing:60212
// revision : 0.001
// tags : paint,dropper,bottle,holder
// file : dropper_bottle_holder.jscad
/* setup */

Keybase proof

I hereby claim:

  • I am tomash on github.
  • I am tomash (https://keybase.io/tomash) on keybase.
  • I have a public key ASDJs7kpi0pvnx_LOk2aJGr0PZ0An9aWW_t6ozuxV4jHewo

To claim this, I am signing this object:

namespace :orders do
desc "make orders abandoned for a few days as cancelled"
task :cleanup => :environment do
Order.abandoned_but_not_marked.each do |order|
begin
order.cancellation_code = "abandoned"
order.save!
rescue => e
$stderr.puts "Could not mark as cancelled and save! order ##{order.id}"
$stderr.puts e.message
@tomash
tomash / inheritance_modules_callbacks.rb
Last active December 18, 2015 08:39
Class variable defined on parent class level being set on the parent class level. Looks like a Ruby-powered "feature" of STI.
# seems to work properly, i.e. exporting_message callback does not pollute
require 'active_support/callbacks'
module Exportage
def self.included(base)
base.class_eval do
set_callback :save, :before, :exporting_message
def exporting_message
puts "exporting..."
end
@tomash
tomash / address_sanity_check.rb
Created November 23, 2012 13:06
fix order addresses #438136
# sanity checking
users_with_multiple_addresses = []
User.all.each do |user|
addresses = Address.where(:addressable_type => 'User', :addressable_id => user.id)
if(addresses.count > 1)
users_with_multiple_addresses << user
end
end