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
@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 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;
View convert.sh
#!/bin/bash
# convert.sh
# util for generating resized images at multiple common display resolutions
SIZES="720 750 1080 1100 1440 1680 2880"
EXTS="jpg JPG jpeg JPEG"
print_res() {
@chetan
chetan / db.rake
Last active Dec 19, 2017 — forked from e12e/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
View db.rake
# lib/tasks/db.rake
# Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90
# Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6
#
# This is the code from the comment:
# https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90#gistcomment-2275324
# Made into a fork/separate gist for easier download, with redundant shell-script removed.
#
#
# Usage:
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 keybase.md

Keybase proof

I hereby claim:

  • I am chetan on github.
  • I am chetan (https://keybase.io/chetan) on keybase.
  • I have a public key whose fingerprint is 0CC2 6FA5 8102 1C53 1774 A3F4 F585 739B 124A CC0F

To claim this, I am signing this object:

View commands.txt
[vagrant@localhost wireguard-0.0.20170421]$ cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[vagrant@localhost wireguard-0.0.20170421]$ uname -a
Linux localhost.localdomain 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[vagrant@localhost wireguard-0.0.20170421]$ sudo dkms build -m wireguard -v 0.0.20170421
@chetan
chetan / memgrp
Last active Nov 5, 2016
A little ruby script to show process memory usage grouped by ppid
View memgrp
#!/usr/bin/env ruby
def run!
ps = []
`ps -el`.split(/\n/).each do |line|
# UID PID PPID F CPU PRI NI SZ RSS WCHAN S ADDR TTY TIME CMD
l = line.split("\s")
x = {
:uid => l.shift,
View supergiant.json
{
"ui_enabled": true,
"psql_host": "localhost",
"psql_db": "supergiant",
"psql_user": "postgres",
"psql_pass": "postgres",
"publish_host": "<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
View supergiant-error.log
/var/log/upstart# cat supergiant-server.log
Generating RSA private key, 2048 bit long modulus
..+++
.............................................................................+++
unable to write 'random state'
e is 65537 (0x10001)
unknown option version="1.0"
req [options] <infile >outfile
where options are
-inform arg input format - DER or PEM
You can’t perform that action at this time.