Skip to content

Instantly share code, notes, and snippets.

@Buthrakaur
Buthrakaur / gitlab_runner_cleanup.sh
Last active March 7, 2024 13:32
gitlab runner cleanup script
#!/bin/bash
# cron setup:
# copy this script to ~
# chmod +x ~/gitlab_runner_cleanup.sh
# crontab -e
# # add following line:
# 0 3 * * * ~/gitlab_runner_cleanup.sh >> ~/gitlab_runner_cleanup.log 2>&1
# Threshold for disk space, set to 5GB (5 * 1024 * 1024 * 1024 bytes)
@Buthrakaur
Buthrakaur / Generate RoundhousE SQL script hash.ps1
Last active June 22, 2023 00:42
RoundhousE script hash calculator to fix already executed script in UP folder without RH complaining about the script change
Param(
[Parameter(Mandatory = $true)]
[string]$file
)
#port of RoundhousE WindowsFileSystemAccess.get_file_encoding
function getFileEncoding($file){
$enc = [System.Text.Encoding]::Default
$buffer = gc $file -Encoding Byte
@Buthrakaur
Buthrakaur / PingUrlParallel.ps1
Created December 4, 2015 15:10
Simple load test tool in powershell
workflow PingUrlParallel {
param(
[string]$url,
[int]$parallelCount = 10,
[int]$iterations = 10
)
foreach -parallel ($x in 1..$parallelCount) {
1..$iterations | %{
@Buthrakaur
Buthrakaur / gist:bf129ea4291a778d14d1c3283011fe33
Last active November 12, 2020 08:20 — forked from masnick/gist:1291199
jQuery inject one-liner
var a=document.createElement("script");a.type="text/javascript";a.async=true;a.src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);
@Buthrakaur
Buthrakaur / profile.ps1
Created December 4, 2018 08:36
cmder profile customization
####################################### APPEND TO EOF cmder\vendor\profile.ps1 ###################################################
function adbr { & adb reverse tcp:8081 tcp:8081 }
function adbm { & adb shell input keyevent 82 }
@Buthrakaur
Buthrakaur / gist:1613003
Created January 14, 2012 21:44
NHibernate QueryOver.List extension to support casting to anonymous types
public static IList<TRes> ListAs<TRes>(this IQueryOver qry, TRes resultByExample)
{
var ctor = typeof (TRes).GetConstructors().First();
return qry.UnderlyingCriteria
.SetResultTransformer(Transformers.AliasToBeanConstructor(ctor))
.List<TRes>();
}
[Fact]
public void ListAs_Should_CastQueryOverResultToTypeSameAsSupliedExampleInstance()
@Buthrakaur
Buthrakaur / cjs.js
Last active November 22, 2017 12:58
Nevercode Cancel All Builds CJS script - adds "Cancel All" button to NC Project detail page (https://app.nevercode.io/#/project/xxx)
(function(){
var cookies;
function readCookie(name,c,C,i){
if(cookies){ return cookies[name]; }
c = document.cookie.split('; ');
cookies = {};
for(i=c.length-1; i>=0; i--){
@Buthrakaur
Buthrakaur / gpx_route_to_track.bat
Last active January 5, 2016 07:39
GPSBabel script to convert GPX route to track - usable for Endomondo workout imports etc. Change faketime value to required value - the value is timestamp of track start "+" number of seconds between points.
REM usage: gpx_route_to_track.bat source.gpx target.gpx
gpsbabel -r -i gpx -f %1 -x transform,trk=rte,del -o gpx -F %2
gpsbabel -r -i gpx -f %2 -x track,faketime=f20160101110000+2 -o gpx -F %2
@Buthrakaur
Buthrakaur / gist:5747058
Created June 10, 2013 07:21
WindsorConfigurationTests
public class WindsorConfigurationTests
{
private readonly WindsorContainer container;
public WindsorConfigurationTests()
{
container = new WindsorContainer();
container.Install(FromAssembly.Named("AppX"));
}
@Buthrakaur
Buthrakaur / Oracle_merge_validity.sql
Last active October 2, 2015 12:48
Oracle merge rows with multiple attributes changing in time on one row.
CREATE TABLE TST_MGA (
from_time NUMBER(22) NOT NULL,
to_time NUMBER(22) NOT NULL,
mga NUMBER(22) NOT NULL);
CREATE TABLE tst_mga_mba(
from_time NUMBER(22) NOT NULL,
to_time NUMBER(22) NOT NULL,
mga NUMBER(22) NOT NULL,
mba NUMBER(22) NOT NULL);