Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
got ci/cd? want some? get in touch

Chetan Sarva chetan

🤖
got ci/cd? want some? get in touch
View GitHub Profile
View yardoc_cheatsheet.md
View cupsd.conf
#
# 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
View update-route53.sh
#!/bin/bash
# Copied from http://willwarren.com/2014/07/03/roll-dynamic-dns-service-using-amazon-route53/
# Externalizing the zone ID and CNAME
if [ -z "$1" ]
then
echo "The first argument needs to be the Hosted Zone ID, i.e. BJBK35SKMM9OE"
exit 1
fi
@chetan
chetan / findHidden.js
Last active May 23, 2020
jQuery func to find out why an element is hidden
View findHidden.js
function found(el, css) {
console.log('Found candidate(s):', el);
console.log('css:', css);
}
function findHidden(sel) {
const transparent = 'rgba(0,0,0,0)';
const el = $(sel);
if (el.length === 0) {
console.log('giving up, no more els');
View adduser
#!/usr/bin/ruby
#
# adduser - Unix-like adduser script. Prompts for parameters and uses dscl internally to create
# new NetInfo users and groups.
#
# Chetan Sarva <csarva@pixelcop.net>
def next_user_id(start = 700)
ids = `dscl . -list /Users UniqueID`.split("\n").map{|s| s =~ /(\d+)$/; $1 }.sort.uniq
n = start
@chetan
chetan / vertica5-installer-ubuntu10.04.patch
Created Nov 30, 2011
patch to enable vertica5 to be installed on ubuntu 10.04 (lucid)
View vertica5-installer-ubuntu10.04.patch
--- /opt/vertica/oss/python/lib/python2.7/site-packages/vertica/network/SystemProfileFactory.py.orig 2011-09-15 14:28:14.000000000 -0400
+++ /opt/vertica/oss/python/lib/python2.7/site-packages/vertica/network/SystemProfileFactory.py 2011-09-15 14:29:51.000000000 -0400
@@ -142,8 +142,14 @@
if (res[0] == '0'):
opsys = DBinclude.OS_DEBIAN
return opsys, host
+
+ (status, res) = ssh.execute("grep \"squeeze\" /etc/debian_version", hide=True)
+ if (res[0] == '0'):
+ opsys = DBinclude.OS_DEBIAN
View gmailAutoarchive.js
// Original author fwed (contact@fwed.fr)
// Modified from
// https://gist.github.com/0x4a/e410aa72fca06fcfafce9f00ff47d82c
// https://gist.github.com/anonymous/2cca33d376f7f924fdaa67891ad098cc
// https://medium.com/@fw3d/auto-archive-emails-in-gmail-after-2-days-1ebf0e076b1c
var OP_ARCHIVE = 1;
var OP_READ = 2;
var OP_DELETE = 4;
@chetan
chetan / fix_roaming_profile_perms.bat
Created Sep 12, 2012
Fix permissions on a roaming profile folder
View fix_roaming_profile_perms.bat
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
@chetan
chetan / skel.rb
Created Aug 15, 2011
Ruby command-line skeleton
View skel.rb
#!/usr/bin/env ruby
# == Synopsis
# This is a sample description of the application.
# Blah blah blah.
#
# == Examples
# This command does blah blah blah.
# ruby_cl_skeleton foo.txt
#
@chetan
chetan / pfdel.pl
Created Sep 15, 2013
Script for cleaning up postfix queue
View pfdel.pl
#!/usr/bin/perl -w
#
# pfdel - deletes message containing specified address from
# Postfix queue. Matches either sender or recipient address.
#
# Usage: pfdel <email_address>
#
# http://www.ustrem.org/en/articles/postfix-queue-delete-en/
use strict;
You can’t perform that action at this time.