Skip to content

Instantly share code, notes, and snippets.

View taybin's full-sized avatar
🤷‍♂️
¯\_(ツ)_/¯

Taybin Rutkin taybin

🤷‍♂️
¯\_(ツ)_/¯
View GitHub Profile
@caffo
caffo / GORILLA.BAS
Created October 31, 2011 03:24
QBasic Gorillas
' Q B a s i c G o r i l l a s
'
' Copyright (C) IBM Corporation 1991
'
' Your mission is to hit your opponent with the exploding banana
@jboner
jboner / latency.txt
Last active June 9, 2024 15:21
Latency Numbers Every Programmer Should Know
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
@ArtemGr
ArtemGr / makefile
Last active February 15, 2024 14:29
SPI helper for a PostgreSQL CHECK when using one-to-many with a jsonb.
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:
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
@terranware
terranware / eb-sns.json
Created May 12, 2015 20:19
Sample Elastic Beanstalk SNS Event
{
"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",
@mramato
mramato / DrawHorizonPoint.js
Created July 14, 2015 01:45
A simple Cesium example of drawing a label at the horizon point.
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,
@gerbsen
gerbsen / ssh_agent_start.fish
Last active January 26, 2024 08:13 — forked from schaary/ssh_agent_start.fish
Auto-launching ssh-agent in fish shell
# 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
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 {
@keshavbahadoor
keshavbahadoor / sql_to_csv.py
Created May 11, 2017 15:14
Convert SQL Query to CSV File in Python
# 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:
@esamattis
esamattis / systemdunit.py
Last active November 10, 2021 23:04
Install Systemd units using Ansible
"""
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