Skip to content

Instantly share code, notes, and snippets.

View mercul3s's full-sized avatar
🐓
Code Farming

Mercedes Coyle mercul3s

🐓
Code Farming
View GitHub Profile
@ghoseb
ghoseb / ns-cheatsheet.clj
Last active November 7, 2024 19:26 — forked from alandipert/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.
@pjkix
pjkix / css-stats-ack.sh
Created October 5, 2011 21:39
shell script to generate some css file statistics
#!/bin/bash
## v1.0.6
## this script will gernerate css stats
### example output
# CSS STATS
# ----------
# Floats: 132
@clintongormley
clintongormley / gist:2049562
Created March 16, 2012 10:50
Elasticsearch to CSV
#!/usr/bin/perl
use ElasticSearch;
use Text::CSV_XS;
my $csv_file = 'output.csv';
open my $fh, '>:encoding(utf8)', $csv_file or die $!;
my $csv = Text::CSV_XS->new;
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@stonith
stonith / curl
Last active March 13, 2017 13:04 — forked from nickethier/curl
logstash elasticsearch template - disable _all field, enable simple analyzer, set default query field to @message
curl -XPUT localhost:9200/_template/logstash -d '
{
"template" : "logs-*",
"settings" : {
"index.analysis.analyzer.default.type": "simple",
"index.cache.field.type": "soft",
"index.compress.stored": true,
"index.merge.policy.max_merged_segment": "5g",
"index.query.default_field": "@message",
"index.refresh_interval": "5s",
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 17, 2024 13:10
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@chriszf
chriszf / gist:3860588
Created October 9, 2012 18:35
Challenge 1 Solution
import os
import shutil
def make_dir(name):
raise Exception()
if not os.path.exists("target /" + name):
os.mkdir("target /" + name)
def main():
file_list = os.listdir("./files")
@chriszf
chriszf / gist:3860594
Created October 9, 2012 18:37
Exercise 09 Solution
def main():
f = open("twain.txt")
text = f.read()
f.close()
text = text.lower()
num_letters = [0] * 26
@airawat
airawat / 00-OozieCoordinatorJobWithFileAsTrigger
Last active February 12, 2018 10:10
Oozie coordinator job example with trigger file as trigger
This gist includes components of a oozie (trigger file initiated) coordinator job -
scripts/code, sample data and commands; Oozie actions covered: hdfs action, email action,
java main action, hive action; Oozie controls covered: decision, fork-join; The workflow
includes a sub-workflow that runs two hive actions concurrently. The hive table is
partitioned; Parsing uses hive-regex serde, and Java-regex. Also, the java mapper, gets
the input directory path and includes part of it in the key.
Usecase
-------
Parse Syslog generated log files to generate reports;