Skip to content

Instantly share code, notes, and snippets.

Rohan Kapadia kapad

  • Bangalore, India
Block or report user

Report or block kapad

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kapad
kapad / toggle-nightlight.sh
Created Jul 3, 2018
Script to toggle the Gnome nightlight setting.
View toggle-nightlight.sh
#!/bin/bash
setting=$(gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled)
if [[ $setting == "true" ]]; then
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false
else
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
fi
@kapad
kapad / docker-compose.yml
Created Mar 7, 2018
docker compose redis cluster
View docker-compose.yml
version: '2'
services:
redis-cluster:
image: grokzen/redis-cluster
hostname: redis-cluster
ports:
- "7000:7000"
- "7001:7001"
- "7002:7002"
- "7003:7003"
@kapad
kapad / docker-compose.yml
Created Mar 7, 2018
docker compose master slave configuration
View docker-compose.yml
version: '3'
networks:
redismasterslave:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.18.0.0/16
View 8.2.3. HTTP log format
8.2.3. HTTP log format
----------------------
The HTTP format is the most complete and the best suited for HTTP proxies. It
is enabled by when "option httplog" is specified in the frontend. It provides
the same level of information as the TCP format with additional features which
are specific to the HTTP protocol. Just like the TCP format, the log is usually
emitted at the end of the session, unless "option logasap" is specified, which
generally only makes sense for download sites. A session which matches the
"monitor" rules will never logged. It is also possible not to log sessions for
@kapad
kapad / dataUriToBinary.js
Created Jun 13, 2017
Convert a base64 encoded data URI to binary
View dataUriToBinary.js
let convertDataURIToBinary = (dataURI) => {
var BASE64_MARKER = ';base64,';
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
var base64 = dataURI.substring(base64Index);
var raw = window.atob(base64);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for(var i = 0; i < rawLength; i++) {
array[i] = raw.charCodeAt(i);
View markdown.css
/*
* Copyright 2013 Alex Pacini.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kapad
kapad / screen-man-simple.md
Last active Aug 1, 2018
Simplified man page/usage instructions for Linux screen command
View screen-man-simple.md

Starting or re-entering an already running session (Works regardless of whether the session was detached properly or the internet connection went kaput)

Command: screen -D -RR If multiple users are going to share the same machine and all want to use screen, then use screen -D -RR <screen-alias>

To start with screen will only have one screen.

To start a new screen keyboard shortcut is

You can’t perform that action at this time.