This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// Here's a simple example to show how to properly terminate multiple go routines by using a context. | |
// Thanks to the WaitGroup we'll be able to end all go routines gracefully before the main function ends. | |
import ( | |
"context" | |
"fmt" | |
"math/rand" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Install Systemd units using Ansible | |
Handles unit restarting and systemd daemon reloading when the unit changes. | |
Also stops the unit correctly when uninstalled | |
In your playbook put this file to library/systemdunit.py and make sure the | |
server has python-sh package installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generic reader method | |
# Reads data, prints columns, and prints each row to file | |
def do_query_to_csv_file(cursor, sql, csv_file): | |
try: | |
cursor.execute(sql) | |
file_header = '' | |
f = open(file_dir + csv_file + '.csv', 'w') | |
columns = [column[0] for column in cursor.description] | |
for col in columns: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonSlurper | |
import org.sonatype.nexus.repository.storage.Asset | |
import org.sonatype.nexus.repository.storage.StorageFacet | |
def DOCKER_REPOSITORY_NAME = 'docker-hosted' | |
def dockerRepository = repository.repositoryManager.get(DOCKER_REPOSITORY_NAME) | |
def dockerBlobStore = blobStore.blobStoreManager.get(dockerRepository.configuration.attributes.storage.blobStoreName) | |
def storageTx = dockerRepository.facet(StorageFacet.class).txSupplier().get() | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# content has to be in .config/fish/config.fish | |
# if it does not exist, create the file | |
setenv SSH_ENV $HOME/.ssh/environment | |
function start_agent | |
echo "Initializing new SSH agent ..." | |
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV | |
echo "succeeded" | |
chmod 600 $SSH_ENV | |
. $SSH_ENV > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var viewer = new Cesium.Viewer('cesiumContainer'); | |
var scene = viewer.scene; | |
var ellipsoid = scene.globe.ellipsoid; | |
var entity = viewer.entities.add({ | |
label : { | |
show : true, | |
outlineColor: Cesium.Color.BLACK, | |
verticalOrigin : Cesium.VerticalOrigin.BOTTOM, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Records": [ | |
{ | |
"EventSource": "aws:sns", | |
"EventVersion": "1.0", | |
"EventSubscriptionArn": "arn:aws:sns:us-east-1...ElasticBeanstalkNotifications-Environment-foo-app...", | |
"Sns": { | |
"Type": "Notification", | |
"MessageId": "111", | |
"TopicArn": "arn:aws:sns:us-east-1...ElasticBeanstalkNotifications-Environment-foo-app", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: spi.so | |
spi.so: spi.o makefile | |
g++ -shared -o spi.so spi.o | |
cp --remove-destination spi.so /var/lib/postgresql/spi.so | |
spi.o: spi.cc makefile | |
g++ -g -O2 -Wall -std=c++11 -fpic -c -o spi.o -I/usr/include/postgresql -I/usr/include/postgresql/9.4/server spi.cc | |
clean: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
NewerOlder