Skip to content

Instantly share code, notes, and snippets.

View CGenie's full-sized avatar
💭
I prefer sourcehut! sr.ht

CGenie

💭
I prefer sourcehut! sr.ht
View GitHub Profile
@CGenie
CGenie / gist:7884f53b2386d74c164b
Created August 11, 2014 17:21
Data.Aeson.Lens problems
{-# LANGUAGE OverloadedStrings #-}
import Data.Aeson.Lens
import Data.Text
import Data.Text.Encoding as E
main = do
lex x = (E.decodeUtf8 "{\"a\": 1}") ^? key "a"
return ()
@CGenie
CGenie / console.html
Created August 12, 2014 10:23
Selenium Firefox console log
<html>
<head>
<script type="text/javascript">
console.log('TEST TEST');
window.dump('DUMP DUMP');
console.error('ERROR ERROR');
</script>
</head>
<body>
@CGenie
CGenie / docker_inspect
Created October 7, 2014 10:18
Strange docker inspect behavior
docker inspect fuel/nailgun_6.0:latest
"config": {
"Hostname": "f218e5ce70a0",
"Domainname": "",
"User": "",
"Memory": 0,
"MemorySwap": 0,
"CpuShares": 0,
"AttachStdin": false,
@CGenie
CGenie / openstack.yaml
Last active August 29, 2015 14:07
openstack.yaml proposal
roles_metadata:
controller:
conflicts:
- compute
conditions:
- condition: "cluster:mode == 'multinode'"
then:
all:
- condition: "selectedNodes._length <= 1"
warning: "Multi-node environment cannot have more than one controller node."
@CGenie
CGenie / openstack.yaml
Last active August 29, 2015 14:07
openstack.yaml with implemented roles
---
- &base_release
model: "nailgun.release"
fields:
state: "available"
modes_metadata:
ha_compact:
description: "This configuration Deploys OpenStack ready for high availability (HA). Controller services are prepared for HA by setting up a base MySQL/Galera, RabbitMQ and HAProxy so that additional controllers can be deployed NOW, or scaled out LATER. 3 or more controllers are required for a true HA environment."
multinode:
description: "In this configuration the OpenStack controller is deployed separately from the compute and cinder nodes. This mode assumes the presence of 1 controller node and 1 or more compute/cinder nodes. You can add more nodes to scale your cloud later."
@CGenie
CGenie / urls.py
Created October 8, 2014 15:22
urls.py proposal
def test():
return ReleaseCollectionHandler
urls = (
...
r'/test/test/?$',
@CGenie
CGenie / field_mapping
Created October 20, 2014 07:36
ES lowercase analyzer
"doc_type_structure": {
"properties": {
"aid": {"type": "string", "index": "analyzed", "analyzer": "not_analyzed_lowercase"}
}
}
ceph-osd:
name: "Storage - Ceph OSD"
description: "Ceph storage can be configured to provide storage for block volumes (Cinder), images (Glance) and ephemeral instance storage (Nova). It can also provide object storage through the S3 and Swift API ( See settings to enable each)."
restrictions:
- condition: "settings:common.libvirt_type.value == 'vcenter'"
message: "Ceph cannot be used with vCenter"
update_once:
- controller
on_delete: warn
@CGenie
CGenie / rankntype.hs
Created February 11, 2015 19:20
RankNType question
{-# LANGUAGE RankNTypes #-}
module Main
where
class Zeroable a where
zero :: a -> Int
@CGenie
CGenie / README.md
Last active April 21, 2021 15:04 — forked from obscurerichard/README.md
Simulates a low bandwidth, high-latency network connection

slow

This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.

slow 3G                   # Slow network on default eth0 down to 3G wireless speeds
slow reset                # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet  with a high latency
slow dsl -b 1mbps         # Simulate DSL with a slower speed than the default

slow modem-56k -d eth0 # Simulate a 56k modem on the eth1 device. eth0 is unchanged.