Skip to content

Instantly share code, notes, and snippets.

View chetan's full-sized avatar
🙌
like my work? sponsor me!

Chetan Sarva chetan

🙌
like my work? sponsor me!
View GitHub Profile
@chetan
chetan / yardoc_cheatsheet.md
Last active May 4, 2024 11:12
YARD cheatsheet
@chetan
chetan / dumpcerts.traefik.v2.sh
Created November 9, 2023 16:24
Convert traefik acme.json to PEM files
#!/usr/bin/env bash
# Copyright (c) 2017 Brian 'redbeard' Harrington <redbeard@dead-city.org>
#
# dumpcerts.sh - A simple utility to explode a Traefik acme.json file into a
# directory of certificates and a private key
#
# Usage - dumpcerts.sh /etc/traefik/acme.json /etc/ssl/
#
# Dependencies -
# util-linux
#
# Sample configuration file for the CUPS scheduler. See "man cupsd.conf" for a
# complete description of this file.
#
# Log general information in error_log - change "warn" to "debug"
# for troubleshooting...
LogLevel warn
# Deactivate CUPS' internal logrotating, as we provide a better one, especially
@chetan
chetan / log4j.properties
Created December 28, 2011 17:08
Sample log4j properties file
# copied from http://www.johnmunsch.com/projects/Presentations/docs/Log4J/log.properties
log4j.rootCategory=debug, rolling
# log4j.rootCategory=warn, stdout, rolling, socketLogger, lf5, xml, lf5Rolling
# Example of adding a specific package/class at a different
# logging level...
# --log everything in the com.johnmunsch package at debug level
# ..even better, send it to a different appender. Note, however, that
# this doesn't mean that any loggers from a lower level won't be used:
@chetan
chetan / config.json
Created April 20, 2021 15:56
meshcentral docker setup with traefik reverse proxy serving TLS
// write this config file at /var/homelabos/meshcentral/data/config.json
{
"$schema": "http://info.meshcentral.com/downloads/meshcentral-config-schema.json",
"settings": {
"cert": "meshcentral.example.com",
"WANonly": true,
"_LANonly": true,
"_sessionKey": "MyReallySecretPassword1",
"port": 80,
"_aliasPort": 443,
@chetan
chetan / WDTVLive.xml
Last active January 5, 2024 10:07 — forked from darth-veitcher/WDTVLive.xml
plex media server dlna profile for wdtv live
<Client name="WD TV Live HD Media Player">
<!-- Author: Plex Inc. -->
<!-- http://www.wdc.com/w...4779-705035.pdf -->
<!-- Model number tested: WDBAAN0000NBK -->
<!-- TODO - a few more limitations around codec profiles, which are high enough that they're probably not worth listing at present -->
<Identification>
<Header name="User-Agent" substring="alphanetworks" />
<Header name="User-Agent" substring="ALPHA Networks" />
</Identification>
<Settings>
upstream subsonic {
server 127.0.0.1:8089;
}
server {
listen 80;
server_tokens off;
server_name subsonic;
@chetan
chetan / list_hadoop_codecs.sh
Last active August 11, 2023 12:38
List the available hadoop codecs
#!/usr/bin/env bash
# list_hadoop_codecs.sh
#
# USAGE:
# curl -sL https://gist.github.com/chetan/6524829/raw/list_hadoop_codecs.sh | bash
# make sure hadoop is avail
if [[ -z `which hadoop 2>/dev/null` ]]; then
echo "hadoop command not found!"
@chetan
chetan / bookmarklet.js
Last active March 9, 2023 01:01
youtube unblocker bookmarklet
javascript:(function(){var%20s=document.createElement('script');s.setAttribute('src','https://code.jquery.com/jquery-2.1.1.min.js');s.setAttribute('type','text/javascript');document.getElementsByTagName('head')[0].appendChild(s);$jq=jQuery.noConflict();$jq("a").each(function(i,el){var%20href=$jq(el).attr("href");var%20matches=href?href.match(/youtube.com\/watch\?.*?v=([a-zA-Z0-9_\-]+)/):null;if(matches){$jq(el).attr("href","https://www.youtube-nocookie.com/embed/"+matches[1]);}});$jq("iframe").each(function(i,el){var%20src=$jq(el).attr("src");var%20matches=src?src.match(/youtube.com\/embed\/([a-zA-Z0-9_\-]+)\??/):null;if(matches){$jq(el).attr("src","https://www.youtube-nocookie.com/embed/"+matches[1]);}});})();
@chetan
chetan / fix_roaming_profile_perms.bat
Created September 12, 2012 03:41
Fix permissions on a roaming profile folder
REM usage: fix_perms.bat <username>
REM Recursively assign ownership to Administrators. Answer prompts with "Y".
takeown /R /A /F %1 /D Y
REM Grant Full permissions on folder and subfolders to Administrators, SYSTEM, and the user
cacls %1 /T /E /P "Administrators":F
cacls %1 /T /E /P SYSTEM:F
cacls %1 /T /E /P %1:F
REM Set owner back to UserName
subinacl.exe /noverbose /subdirectories %1\*.* /setowner=%1