Skip to content

Instantly share code, notes, and snippets.

View topas's full-sized avatar

Tomáš Pastorek topas

  • Avast, naZavody.cz, Lumibee
  • Czech Republic
View GitHub Profile
@topas
topas / delete_gh_actions_runs.sh
Last active December 5, 2023 11:08
Delete last 100 Github Action runs
# build - Workflow name
# [0:X] - X - items to delete
gh run list -w "build" --limit 10000 --json createdAt,databaseId -q ". |= sort_by(.createdAt)[0:100] | .[].databaseId" | xargs -IID gh run delete ID
@topas
topas / flickr_title_and_description.js
Last active June 21, 2019 15:48
Flickr batch title and description setter ... just run it in browser's console
var title = "Photo title";
var description = "Photo description";
document.querySelectorAll('.together_description').forEach(elm => { elm.value = description; elm.dispatchEvent(new Event("change")) });
document.querySelectorAll('.together_title').forEach(elm => { elm.value = title; elm.dispatchEvent(new Event("change")) });
document.getElementById("batch_edit_together_form_save_button").scrollIntoView();
@topas
topas / cygwin-shell.reg
Created June 1, 2016 12:51 — forked from peterwooley/mintty.reg
Assuming chere is insalled, this adds an "Open mintty Here" context menu option for Windows Explorer drives and folders.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\mintty]
@="Open Shell Here"
[HKEY_CLASSES_ROOT\Directory\shell\mintty\command]
@="c:\\cygwin\\bin\\mintty.exe -e /bin/xhere /bin/fish.exe \"%L\""
[HKEY_CLASSES_ROOT\Drive\shell\mintty]
@="Open Shell Here"
@topas
topas / CancelableNavigationController.swift
Last active October 21, 2022 06:25
UINavigationController with cancellable swipe back (left) gesture
import UIKit
protocol SwipeBackDelegate: class {
func shouldSwipeBackStarted(point: CGPoint) -> Bool
func swipeBackFinished() -> Bool
func swipeBackNotFinished()
}
class CancelableNavigationController: UINavigationController, UIGestureRecognizerDelegate, UINavigationControllerDelegate {
@topas
topas / gist:8cffcb763ec2b7a4eaf6
Created February 9, 2015 00:12
Cygwin Git configuration p4merge as mergetool and difftool (part of .gitconfig file)
# run ln -s /cygdrive/c/Program\ Files/Perforce/p4merge.exe /usr/bin/p4merge
[diff]
tool = p4diff
[merge]
keepBackup = false
tool = p4merge
[mergetool "p4merge"]
cmd = /usr/bin/p4merge \"$(cygpath -w \"$BASE\")\" \"$(cygpath -w \"$LOCAL\")\" \"$(cygpath -w \"$REMOTE\")\" \"$(cygpath -w \"$MERGED\")\"
prompt = false
@topas
topas / gist:2299597
Created April 4, 2012 08:00
Batch: Date and time in custom format
:: http://stackoverflow.com/questions/203090/how-to-get-current-datetime-on-windows-command-line-in-a-suitable-format-for-us
@ECHO off
set v_day=
set v_month=
set v_year=
SETLOCAL ENABLEEXTENSIONS
if "%date%A" LSS "A" (set toks=1-3) else (set toks=2-4)
::DEBUG echo toks=%toks%
for /f "tokens=2-4 delims=(-)" %%a in ('echo:^|date') do (
@topas
topas / gist:1919858
Created February 26, 2012 23:48
ASP.NET MVC Html.LabelFor helper with html attributes
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Web.Mvc;
using System.Web.Routing;
public static class LabelExtensions
{
public static MvcHtmlString LabelFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, object htmlAttributes)
{
@topas
topas / coverage.bat
Created April 10, 2011 19:59
Code coverage generation script for VS2010 and xUnit, NUnit, etc.
@echo off
set curdir=%~dp0
set outputdir=.\bin\
set xunitfile="xunit.console.clr4.x86.exe"
set instr="c:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\VSInstr.exe"
set perfcmd="c:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\VSPerfcmd.exe"
mkdir %outputdir%