Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Grebs EnTeQuAk

  • Mozilla
  • Berlin, Germany
View GitHub Profile
@stephen-puiszis
stephen-puiszis / elasticsearch-cheatsheet.txt
Last active Jun 4, 2021
Elasticsearch Cheatsheet - An Overview of Commonly Used Elasticsearch API Endpoints and What They Do
View elasticsearch-cheatsheet.txt
# 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 Jun 23, 2021
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
View arch-linux-install
# 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 Dec 22, 2015
WIP Client-side Riak CRDT API for Python
View crdt.py
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 Jul 30, 2013
This requires that `ifstat`, `sysstat` and `bc` are installed and that `$LIBRATO_USER` and `$LIBRATO_TOKEN` are available in the environment.
View send_system_stats.sh
#!/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 Dec 16, 2015
An example of a pattern I use when using requests to wrap an api.
View ProviderAPIWrapper.py
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 May 12, 2021
Copy data from a Time Machine volume mounted on a Linux box.
View copy-from-time-machine.sh
#!/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.
#
View gist:4160894
import uuid
alphabet = (
'!"#$%&\'()*+,-./0123456789:;<=>?@'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
'[\\]^_`'
'abcdefghijklmnopqrstuvwxyz{|}~'
)
@amueller
amueller / ml_with_sklearn_notebook.ipynb
Created Oct 29, 2012
Teaser on machine learning with scikit-learn
View ml_with_sklearn_notebook.ipynb
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 Oct 25, 2012
Sort one million 8-digit numbers in 1MB RAM
View sort1mb.cpp
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------
@ojii
ojii / namegen.py
Created Oct 18, 2012
Simple random name generator
View namegen.py
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',