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 / 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 / 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 / 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 / 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 / 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 / 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);
@Buthrakaur
Buthrakaur / OracleLogging.cs
Last active August 29, 2015 14:17
Oracle ODP.NET SQL Logging
public class OracleConnectionProvider
{
private readonly ProxyGenerator proxyGenerator = new ProxyGenerator();
private readonly IInterceptor interceptor = new SqlLoggingInterceptor(SqlLogger);
public IDbConnection CreateConnection()
{
var con = new OracleConnection(connectionString);
con.Open();
public class OracleManagedDataClientDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider
{
private const string driverAssemblyName = "Oracle.ManagedDataAccess";
private const string connectionTypeName = "Oracle.ManagedDataAccess.Client.OracleConnection";
private const string commandTypeName = "Oracle.ManagedDataAccess.Client.OracleCommand";
private static readonly SqlType GuidSqlType = new SqlType(DbType.Binary, 16);
private readonly PropertyInfo oracleCommandBindByName;
private readonly PropertyInfo oracleDbType;
private readonly object oracleDbTypeRefCursor;