Skip to content

Instantly share code, notes, and snippets.

View akissa's full-sized avatar

Andrew Colin Kissa akissa

View GitHub Profile
@subfuzion
subfuzion / dep.md
Last active July 25, 2024 03:38
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

#include <sys/socket.h>
#include <netinet/in.h>
// #include <linux/if_ether.h>
#include <stdio.h>
#include <stdlib.h>
#define IPPROTO_OSPFIGP 89
void error(int ret, const char *err) {
printf("%s: ret=%d\n", err, ret);
@bborysenko
bborysenko / sphinx_index_usage
Created December 6, 2016 12:41
Sphinx Index Memory Usage
#!/bin/bash
total_ram_bytes=0
total_disk_bytes=0
format="%12s | %12s | %20s\n"
printf "%16s | %12s | %12s\n" "index" "ram_bytes" "disk_bytes"
echo "---------------------------------------------------------"
@elico
elico / client.go
Created July 26, 2016 00:21
golang tcp client connection alive check
package main
import (
"fmt"
"io"
"net"
"time"
)
func main() {
@ijin
ijin / lambda_git.py
Created February 18, 2016 03:01
use git from lambda
from __future__ import print_function
import os
import sys
import subprocess
import boto3
from botocore.client import Config
from dulwich.errors import (
SendPackError,
@jpf
jpf / app.py
Created March 21, 2015 00:46
Example SAML SP using PySAML2. Can handle IdP initiated requests and make SP initated (authn) requests
# -*- coding: utf-8 -*-
import logging
import os
import uuid
from flask import Flask
from flask import redirect
from flask import request
from flask import url_for
from flask.ext.login import LoginManager
@skiane
skiane / create-centos-6.5-mini-unattended-iso.sh
Last active March 14, 2023 23:48
# This script create a Centos Minimal Unattended ISO
# This script create a Centos Minimal Unattended ISO
# This method is based on excellent article http://pyxlmap.net/technology/software/linux/custom-centos-iso
#
# This script has be tested with CentOS 6.5
# TODO:
# * test package update to reduce the update task on the target system. The following command downloads all updates :
# (cd $CENTOS_CUSTOM_PATH/Packages ; yumdownloader $(for i in *; { echo ${i%%-[0-9]*}; } ) )
# Some global settings :
@thwarted
thwarted / ldd.out
Created March 19, 2014 20:22
mysql and postgres ODBC setup for SSL, notes on iodbc and unixODBC
# this uses iodbc, compile postgresql-odbc with --with-iodbc
$ ldd /usr/lib64/psqlodbcw-iodbc.so | grep odbc
libiodbc.so.2 => /lib64/libiodbc.so.2 (0x00007f686e30a000)
libiodbcinst.so.2 => /lib64/libiodbcinst.so.2 (0x00007f686e0f7000)
# this uses unixODBC, compile postgresql-odbc with --with-unixodbc
$ ldd /usr/lib64/psqlodbcw-unixodbc.so | grep odbc
@clemensg
clemensg / etc_sysctl.conf
Created February 5, 2014 16:50
My FreeBSD /etc/sysctl.conf
# /etc/sysctl.conf
# Clemens Gruber, 2014
#
# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
security.bsd.see_other_uids=0
## I/O
@hest
hest / gist:8798884
Created February 4, 2014 06:08
Fast SQLAlchemy counting (avoid query.count() subquery)
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()