Skip to content

Instantly share code, notes, and snippets.

conr / TerminalWindowsToCtrl.ahk
Last active August 7, 2023 13:56
Remap LWin to LCtrl when Windows Terminal is focused (Auto Hot Key)
; Remap LWin to LCtrl when Windows Terminal is focused (Auto Hot Key)
#IfWinActive ahk_class CASCADIA_HOSTING_WINDOW_CLASS ; Check if Windows Terminal is active
LWin::LCtrl ; Remap left Windows key to left Ctrl key
; Script to assign alt+` and alt+escape the functionality to cycle through windows of the same application.
WinGetClass, OldClass, A
WinGet, ActiveProcessName, ProcessName, A
WinGet, WinClassCount, Count, ahk_exe %ActiveProcessName%
# Your init script
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
# An example hack to log to the console when each text editor is saved.
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# Quick Sort - Runtime: Average O(n log(n)), Worst O(n^2), Memory O(log(n))
def quick_sort(arr, left, right)
index = partition(arr, left, right)
if left > index - 1
quick_sort(arr, left, index - 1)
if index < right
quick_sort(arr, index, right)
conr / search.rb
Created January 21, 2018 19:06
Search in rotated sorted array
def search(nums, target)
if nums.length == 0
return -1
low, high = 0, nums.length-1
while low <= high
mid = (high+low)/2
if nums[mid] == target
return mid
# Worst case O(N^2)
# Selection Sort
# Best, Avg, Worst O(N^2) TC
# Worst SC O(1)
def selection_sort(arr)
for i in 0...(arr.length-1)
package main
import (
conr / config.rb
Last active December 7, 2017 17:07
RoR Prometheus
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
require 'rack'
require 'prometheus/middleware/collector'
require 'prometheus/middleware/exporter'
use Rack::Deflater
use Prometheus::Middleware::Collector
use Prometheus::Middleware::Exporter
conr /
Last active December 6, 2017 10:57
Little script I use for appending a tonne of dummy scrape configs to the end of a prometheus.yml configuration file.
from jinja2 import Template
file = open('prometheus.yml', 'a')
templ = Template(u'''\
- job_name: {{ name }}
metrics_path: /export
command: [check_load]
conr /
Last active October 20, 2017 13:27
Removes Prometheus Ansible Demo from target machine
apt-get remove --purge grafana
directories=(/opt/prometheus /etc/prometheus /var/log/prometheus /var/lib/prometheus /var/lib/pushgateway /var/lib/alertmanager /var/lib/node_exporter)
for i in "${directories[@]}"
rm -rf $i
conr /
Last active September 21, 2017 10:01
Atom packages.json for syncing across different machines.
# initialization file (not found)