Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View EnTeQuAk's full-sized avatar

Christopher Grebs EnTeQuAk

  • Mozilla
  • Berlin, Germany
View GitHub Profile
@stephen-puiszis
stephen-puiszis / elasticsearch-cheatsheet.txt
Last active March 14, 2024 10:32
Elasticsearch Cheatsheet - An Overview of Commonly Used Elasticsearch API Endpoints and What They Do
# Elasticsearch Cheatsheet - an overview of commonly used Elasticsearch API commands
# cat paths
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
@mattiaslundberg
mattiaslundberg / arch-linux-install
Last active March 29, 2024 08:38
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@seancribbs
seancribbs / crdt.py
Last active December 22, 2015 02:58
WIP Client-side Riak CRDT API for Python
from collections import MutableSet, MutableMapping, Mapping
class DataType(object):
def __init__(self, value=None, context=None):
if value is not None:
self._check_value(value)
self.value = value
if context:
self.context = context
@benubois
benubois / send_system_stats.sh
Created July 30, 2013 17:58
This requires that `ifstat`, `sysstat` and `bc` are installed and that `$LIBRATO_USER` and `$LIBRATO_TOKEN` are available in the environment.
#!/bin/bash
hostname=$(hostname)
# Run top twice, first output is cached
top_out=$(top -bn2 -d0.1)
cpu=$(echo "${top_out}" | grep "Cpu(s)" | sed -E "s/.*,\s*([0-9\.]+)\%id.*/\1/" | awk '{print 100 - $1}' | sed -n 2p)
memory_total=$(echo "${top_out}" | grep "Mem:" | awk {'print $2'} | sed s/k// | sed -n 2p)
@echohack
echohack / ProviderAPIWrapper.py
Last active December 16, 2015 09:48
An example of a pattern I use when using requests to wrap an api.
import requests
import json
class AbstractDataProvider():
"""A list of methods that data providers should implement or extend."""
def __init__(self, base_url, username=None, password=None):
self.base_url = base_url.rstrip('/')
self.username = username
self.password = password
@vjt
vjt / copy-from-time-machine.sh
Last active March 8, 2024 17:05
Copy data from a Time Machine volume mounted on a Linux box.
#!/bin/bash
#
# Copy data from a Time Machine volume mounted on a Linux box.
#
# Usage: copy-from-time-machine.sh <source> <target>
#
# source: the source directory inside a time machine backup
# target: the target directory in which to copy the reconstructed
# directory trees. Created if it does not exists.
#
import uuid
alphabet = (
'!"#$%&\'()*+,-./0123456789:;<=>?@'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
'[\\]^_`'
'abcdefghijklmnopqrstuvwxyz{|}~'
)
@amueller
amueller / ml_with_sklearn_notebook.ipynb
Created October 29, 2012 15:55
Teaser on machine learning with scikit-learn
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@preshing
preshing / sort1mb.cpp
Created October 25, 2012 11:28
Sort one million 8-digit numbers in 1MB RAM
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------
@ojii
ojii / namegen.py
Created October 18, 2012 09:30
Simple random name generator
from random import choice
import sys
SYLLABLES = [
'a', 'e', 'i', 'o', 'u',
'ka', 'ke', 'ki', 'ko', 'ku',
'ga', 'ge', 'gi', 'go', 'gu',
'sa', 'se', 'shi', 'so', 'su',
'ja', 'je' ,'ji', 'jo', 'ju',
'za', 'ze', 'chi', 'zo', 'zu',