Skip to content

Instantly share code, notes, and snippets.

View crccheck's full-sized avatar

Chris Chang crccheck

View GitHub Profile
@crccheck
crccheck / bash.md
Created August 17, 2021 19:44
CLI fu

Grab a column out of a CSV with header, surround with quotes, and put commas between

echo $(csvcut -c UUID path_to.csv | tail -n +2 | awk '{ print """$0""" }') | tr ' ' ,

@crccheck
crccheck / kafka-connect.md
Last active March 31, 2021 17:42
Kafka Connect cheatsheet

Errors

Halt on all errors. Useful for debugging.

errors.tolerance=none
errors.log.include.messages=true
errors.log.enable=true

Keep going no matter what.

@crccheck
crccheck / splunk recipes.md
Last active September 30, 2021 20:27
Splunk recipes

Histogram of a natural number field NOTE: the x-axis ends up being ordinal instead of linear so it can look like 1 2 3 5 6 8 12 instead of 1 2 3 4 5 6 7 ...

| stats count AS attempts by url_path
| rex field=url_path mode=sed "s/.*/1/"
| stats sum(url_path) by attempts
| sort num(attempts)
@crccheck
crccheck / readme.md
Created January 27, 2021 01:15
Siege recipes
@crccheck
crccheck / README.md
Last active August 4, 2020 16:22
ungzip nock.recorder.rec() output

https://github.com/nock/nock#recording

Recording

This is a cool feature:

Guessing what the HTTP calls are is a mess, especially if you are introducing nock on your already-coded tests.

For these cases where you want to mock an existing live system you can record and playback the HTTP calls like this:

@crccheck
crccheck / request timeout pool.js
Created August 23, 2018 21:53
timeout is a good idea
// In another window, run
//
// $ nc -kl 4200
//
// -k keepalive (BSD/OSX only)
// -l 4200 listen on port 4200
const requestP = require('request-promise-native');
const now = Date.now();
// never finishes
Pull down a random branch
```
git pull [email protected]:crccheck/PyGithub [master]
```
@crccheck
crccheck / jquery.draggable.js
Created October 6, 2017 16:39 — forked from Arty2/jquery.draggable.js
jQuery plugin to make elements draggable without jQuery UI. Usage: view source on http://jqueryui.com/draggable/
/*--------------------------------------------------------------
Draggable
alternative to jQuery UI’s draggable
based on comments from: http://css-tricks.com/snippets/jquery/draggable-without-jquery-ui/
usage example: $('.post-thumbnail, article header').draggable();
--------------------------------------------------------------*/
// https://gist.github.com/Arty2/11199162
$.fn.draggable = function () {
this
.css('cursor', 'move')
@crccheck
crccheck / gist:8fc7bb0ea43243f47c7a4bc5adfe4b27
Last active July 7, 2017 19:58
So you want to delete something in git
git remote remove <name>
git tag -d <tagname>
git branch -d <branchname>
git stash drop
@crccheck
crccheck / SlackRenderer.py
Created November 24, 2016 05:44
A CommonMark-py renderer for Slack.
class SlackRenderer(commonmark.HtmlRenderer):
"""A CommonMark-py renderer for Slack."""
def __init__(self, *args, **kwargs):
"""Override to disable html tags."""
super().__init__(*args, **kwargs)
self.disable_tags = 1
def out(self, s):
"""Override to disable xml escaping."""
self.lit(s)