Skip to content

Instantly share code, notes, and snippets.

hamidzr /
Last active June 2, 2023 01:43
Lenovo Carbon X1 Gen 7 - Audio and microphone fix - might be all you need.
# README You probablyl don't need this script anymore. Please read the comments below to catch up.
## Description
# Lenovo Carbon X1 Gen 7 - Audio and microphone fix - kernel 5.3+ required.
# The script has only been tested for Arch and OpenSuse,
# Original thread:
# Prereq: Install Linux 5.3 or newer
variable "hcloud_token" {
provider "hcloud" {
token = "${var.hcloud_token}"
resource "hcloud_server" "kube-master" {
name = "kube-master"
image = "ubuntu-18.04"
eelsivart /
Last active September 21, 2023 09:31 — forked from sh1n0b1/
Heartbleed (CVE-2014-0160) Test & Exploit Python Script
# Modified by Travis Lee
# Last Updated: 4/21/14
# Version 1.16
# -changed output to display text only instead of hexdump and made it easier to read
# -added option to specify number of times to connect to server (to get more data)
# -added option to send STARTTLS command for use with SMTP/POP/IMAP/FTP/etc...
# -added option to specify an input file of multiple hosts, line delimited, with or without a port specified (host:port)
mdpatrick / postgresql_9.1_to_9.3_on_ubuntu_12.04
Last active June 21, 2018 10:35
Upgrade PostgreSQL from 9.1 to 9.3 on Ubuntu 12.04
View postgresql_9.1_to_9.3_on_ubuntu_12.04
# Probably excessive, but it makes these instructions simpler
sudo -i
# Add postgresql repo and update apt listing
echo "deb squeeze-pgdg main" > /etc/apt/sources.list.d/pgdg.
wget --quiet -O - | sudo apt-key add -
apt-get update
# For some reason this is necessary with PostgreSQL on Ubuntu 12.04
update-alternatives --remove postmaster.1.gz /usr/share/postgresql/9.1/man/man1/postmaster.1.gz
clintongormley / gist:3888120
Created October 14, 2012 09:44
Upgrading a running elasticsearch cluster
View gist:3888120

Yesterday I upgraded our running elasticsearch cluster on a site which serves a few million search requests a day, with zero downtime. I've been asked to describe the process, hence this blogpost.

To make it more complicated, the cluster was running elasticsearch version 0.17.8 (released 6 Oct 2011) and I upgraded it to the latest 0.19.10. There have been 21 releases between those two versions, with a lot of functional changes, so I needed to be ready to roll back if necessary.

Our setup:

  • elasticsearch

We run elasticsearch on two biggish boxes: 16 cores plus 32GB of RAM. All indices have 1 replica, so all data is stored on both boxes (about 45GB of data). The primary data for our main indices is also stored in our database. We have a few other indices whose data is stored only in elasticsearch, but are updated once daily only. Finally, we store our sessions in elasticsearch, but active sessions are cached in memcached.

apk /
Created April 18, 2012 15:51
A web socket server as a bash script.
# WebSocket shell, start & browse to http://<Host>:6655/
# Requires bash 4.x, openssl.
# Author: (which isn't me, apk)
coproc d { nc -l -p 6656 -q 0; }
nc -l -p 6655 -q 1 > /dev/null <<-ENDOFPAGE
HTTP/1.1 200 OK
<html><head><script language="javascript">
var url = location.hostname + ':' + (parseInt(location.port) + 1);
jbraeuer /
Created February 1, 2012 08:43
Install graphite 0.9.9 on Ubuntu 11.10 using PACKAGES
#! /bin/bash
# This script needs "fpm". If you dont have it,
# run "gem install fpm"
# You also need to "apt-get install python-setuptools" (otherwise fpm fails)
clean() {
rm -rf whisper-0.9.9 carbon-0.9.9 graphite-web-0.9.9
chalmerj / gist:1492384
Created December 18, 2011 04:39
Init script for Graphite carbon-cache
View gist:1492384
#! /bin/sh
# Provides: carbon-cache
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: carbon-cache init script
# Description: An init script for Graphite's carbon-cache daemon.
cdown / gist:1163649
Last active August 15, 2023 17:31
Bash urlencode and urldecode
View gist:1163649
urlencode() {
# urlencode <string>
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in