Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: sudo $0 /dev/sdh1"
exit 1;
fi
dd if=$1 of=/dev/null & pid=$!
while true; do
ps -p$pid --no-heading || break;
echo "-- $(date) ------------------";
@reyjrar
reyjrar / elasticsearch.yml
Last active May 12, 2023 11:58
ElasticSearch config for a write-heavy cluster
##################################################################
# /etc/elasticsearch/elasticsearch.yml
#
# Base configuration for a write heavy cluster
#
# Cluster / Node Basics
cluster.name: logng
# Node can have abritrary attributes we can use for routing
@4ndrej
4ndrej / SSLPoke.java
Last active January 3, 2024 09:50
Test of java SSL / keystore / cert setup. Check the comment #1 for howto.
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
@gschueler
gschueler / rundeck-config.groovy
Created June 4, 2013 16:18
Example rundeck-config for SMTP mail configuration
loglevel.default = "DEBUG"
rdeck.base = "/var/lib/rundeck"
rss.enabled = true
dataSource {
dbCreate = "update"
url = "jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;MVCC=true"
}
@sakalajuraj
sakalajuraj / squid.conf
Last active August 1, 2020 00:48
Logstash filter for squid log
# Content of the file /etc/logstash/conf.d/squid.conf
# Squid logs MAC address of the source host
# Logs are sending by syslog-ng raw without standard log headers
input {
tcp {
host => "xxx.xxx.xxx.xxx"
port => xxxx
type => SQUID
tags => [SQUID]

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

#!/usr/bin/env ruby
require 'rubygems' if RUBY_VERSION < '1.9.0'
require 'sensu-handler'
require 'hipchat'
require 'timeout'
module Sensu::Extension
class Hipchat < Handler # Sub-class the appropriate extension type
@ghaering
ghaering / dbg-cloud-init
Created May 27, 2014 07:22
Re-run cloud init scripts on Ubuntu 12.04 (AWS)
#!/bin/sh
rm -rf /var/lib/cloud/sem/* /var/lib/cloud/instance /var/lib/cloud/instances/*
cloud-init start 2>&1 > /dev/null
cloud-init-cfg all final
@DmZ
DmZ / pre-commit
Last active July 25, 2023 13:40
Git pre-commit hook to search for Amazon AWS API keys.
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi