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 / editor.js
Created December 27, 2021 22:03 — forked from image72/editor.js
simple react sandbox playground
import {EditorState, EditorView, basicSetup} from "@codemirror/basic-setup"
import {javascript} from "@codemirror/lang-javascript"
const jscode=`
// Note:
// 1. Use React.something instead of importing something
// 2. Container id is 'app'
function Counter({initialCount}) {
// 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 / db.rake
Last active July 12, 2022 19:18 — forked from e12e/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# 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:
#!/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 / 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>
@chetan
chetan / tomcat.initd.sh
Last active January 20, 2022 13:45 — forked from valotas/tomcat.sh
tomcat init.d script
#!/bin/bash
#
# tomcat This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
def apps = [ "app1":
[ "repos": ["foo", "bar"],
"name": "app1",
"version": 1
],
"app2":
[ "repos": ["foo"],
"name": "app2",
"version": 3
@chetan
chetan / new_bashrc.sh
Created August 31, 2012 17:28 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
@chetan
chetan / latency.txt
Created May 31, 2012 13:57 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns 3 µs
Send 2K bytes over 1 Gbps network 20,000 ns 20 µs
Read 1 MB sequentially from memory 250,000 ns 250 µs
Round trip within same datacenter 500,000 ns 0.5 ms
Disk seek 10,000,000 ns 10 ms
@chetan
chetan / ideal ops.md
Created May 30, 2012 21:14 — forked from bhenerey/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan