Skip to content

Instantly share code, notes, and snippets.

View davidejones's full-sized avatar
🤷‍♂️
keep our code running while other packages are changing theirs

David Jones davidejones

🤷‍♂️
keep our code running while other packages are changing theirs
View GitHub Profile
@nolim1t
nolim1t / socket.c
Created June 10, 2009 03:14
HTTP Request in C using low level write to socket functionality
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
@iamgreaser
iamgreaser / hello.asm
Created October 28, 2011 23:11
My First Assembly Program
; nasm hello.asm -o hello.com
; dosbox hello.com
bits 16
org 0x0100
mov ah,0x09
mov dx,str_hello
int 0x21
int 0x20
@mplacona
mplacona / sender.cfm
Created July 28, 2012 21:36
RabbitMQ ColdFusion "Add to queue example"
<cfscript>
QueueName = "QTransactions";
durable = true;
loadPaths = arrayNew(1);
loadPaths[1] = expandPath("lib/rabbitmq-java-client-bin-2.8.4/rabbitmq-client.jar");
// load jars
javaLoader = createObject("component", "lib.javaloader.JavaLoader").init(loadPaths);
@alicial
alicial / amz-s3-bucket-policy
Created September 13, 2012 18:26
Amazon S3 Bucket Policy to prevent hot linking
{
"Version": "2008-10-17",
"Id": "0c762de8-f56b-488d-a4a4-20d1cb31df2f",
"Statement": [
{
"Sid": "Allow in my domains",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@jareware
jareware / SCSS.md
Last active May 19, 2024 14:03
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@tknerr
tknerr / Vagrantfile
Last active January 28, 2024 09:12
Sample Vagrantfile that works with all providers (virtualbox, aws, managed) and in combination with the vagrant-omnibus plugin
#
# Vagrantfile for testing
#
Vagrant::configure("2") do |config|
# the Chef version to use
config.omnibus.chef_version = "11.4.4"
def configure_vbox_provider(config, name, ip, memory = 384)
config.vm.provider :virtualbox do |vbox, override|
@w-vi
w-vi / zlib_gzip.py
Created April 1, 2014 15:15
How to call zlib to get the gzip inflate / deflate ... definitely not sure if it works in general but so far haven't found where it doesn't.
import zlib
"""
zlib.compressobj(...) ⇒ deflateInit(...)
compressobj.compress(...) ⇒ deflate(...)
zlib.decompressobj(...) ⇒ inflateInit(...)
decompressobj.decompress(...) ⇒ inflate(...)
"""
def deflate(data, compresslevel=9):
compress = zlib.compressobj(
compresslevel, # level: 0-9

THIS DOCUMENT

IS OUT OF

DATE

C++ Coding Standards Part 0: Automated Code Analysis

Automated analysis is the main advantage to working with a modern statically typed compiled language like C++. Code analysis tools can inform us when we have implemented an operator overload with a non-canonical form, when we should have made a method const, or when the scope of a variable can be reduced.

@czarneckid
czarneckid / Zero downtime deploys with gunicorn.markdown
Last active August 31, 2016 17:42
Zero downtime deploys with gunicorn

Zero downtime deploys with gunicorn

Below are the actual files we use in one of our latest applications at Agora Games to achieve zero downtime deploys with gunicorn. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Salient points for each file:

  • gunicorn.py: The pre_fork function looks for gunicorn's old PID file in the proper file and sends the proper QUIT signal to the old process once the new process is running.
  • sv-gunicorn-run.jinja: This is the runit template we use in our Salt-managed infrastructure for handling the application process management. You could just as easily convert this to a non-templatized version.
@Integralist
Integralist / Makefile
Last active January 22, 2024 00:30 — forked from isaacs/Makefile
Example of a detailed Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.