Skip to content

Instantly share code, notes, and snippets.

View k4rtik's full-sized avatar

Kartik Singhal k4rtik

View GitHub Profile
#!/usr/bin/env bash
clang-tidy \
-fix \
-fix-errors \
-header-filter=.* \
--checks=readability-braces-around-statements,misc-macro-parentheses \
$1 \
-- -I.
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
# We want to set the prefix to C-a. C-b is kind of awkward. C-a works well if
# CAPSLOCK is remapped to Ctrl.
set -g prefix C-a
unbind C-b
# We want to imitate WMs like i3 and allow tmux to reload its config in a few
# keystrokes.
bind r source-file ~/.tmux.conf
# We never want to use the mouse.
#!/usr/bin/env python2
from z3 import *
import math
# RAID-4 Non-Rotating Parity 0
class RealBlock(object):
def __init__(self, k, i, j, v):
self.k = k
self.i = i
@k4rtik
k4rtik / dup2mod.go
Created November 27, 2015 04:27
One solution to Exercise 1.4 in GoPL
package main
import (
"bufio"
"fmt"
"os"
)
type LnFile struct {
Count int
@k4rtik
k4rtik / schemer.rkt
Last active September 22, 2019 14:56
Definitions written while working through The Little Schemer code on DrRacket
#lang racket
(define atom?
(lambda (x)
(and (not (pair? x))
(not (null? x)))))
; list of atoms?
(define lat?
(lambda (x)
@k4rtik
k4rtik / keybase.md
Created January 9, 2015 17:51
KeybaseIO proof

Keybase proof

I hereby claim:

  • I am k4rtik on github.
  • I am k4rtik (https://keybase.io/k4rtik) on keybase.
  • I have a public key whose fingerprint is E53F 7004 EAA7 3D1F 33CF 35AB 8868 ADA4 B129 C858

To claim this, I am signing this object:

@k4rtik
k4rtik / Delete mass Drupal content
Created June 14, 2013 06:13
iMacros script for deleting a lot of spam content on a Drupal website.
VERSION BUILD=6011206 RECORDER=CR
URL GOTO=http://a.drupal.website/admin/content/node
'REFRESH
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:node-admin-content ATTR=* CONTENT=YES
TAG POS=1 TYPE=SELECT FORM=ID:node-admin-content ATTR=ID:edit-operation CONTENT=%delete
SET !TIMEOUT 2
SET !ERRORIGNORE YES
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:node-admin-content ATTR=ID:edit-submit-1
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:node-admin-content ATTR=ID:edit-submit
@k4rtik
k4rtik / vmstats.py
Created October 23, 2012 13:04
Simple utility to display stats of all active (running) KVM virtual machines, wrote for Fedora 17 platform for IBM Virtual Tux contest.
#!/usr/bin/env python
import os
import sys
import commands
status, domains = commands.getstatusoutput("virsh list | grep running | cut -f7 -d' '")
domains = domains.rsplit('\n')