Skip to content

Instantly share code, notes, and snippets.

krallin / can-it-fork.c
Last active Jun 12, 2016
Can it fork?
View can-it-fork.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/mman.h>
#define PRINT_ERROR(...) fprintf(stdout, "[ERROR (%i)] ", getpid()); fprintf(stdout, __VA_ARGS__); fprintf(stdout, "\n");
View gist:7cbd0f431d7be5ff3d40
### Keybase proof
I hereby claim:
* I am krallin on github.
* I am torozco ( on keybase.
* I have a public key whose fingerprint is 6380 DC42 8747 F6C3 93FE ACA5 9A84 159D 7001 A4E5
To claim this, I am signing this object:
View gist:9e69f9c6d58d995b66bc
#!/bin/bash -e
# based on
# Helper script to update the Last modified timestamp of files in a Git SCM
# Projects working Copy
# When you clone a Git repository, it sets the timestamp of all the files to the
# time when you cloned the repository.
# This becomes a problem when you want the cloned repository, which is part of a
krallin /
Created Sep 24, 2014
Scalr Provided Script -- Resolve CVE-2014-6271 on managed instances
has_yum=$(which yum)
has_apt=$(which apt-get)
function is_vulnerable {
env x='() { :;}; echo vulnerable' bash -c "echo this is a test" | grep "vulnerable"
return $?
View gist:4137f6b06dcc47ab3340
import boto.ec2
# Connect to EC2
conn = boto.ec2.connect_to_region("us-east-1") # Credentials are in the environment!
# Create a new SG
security_group = conn.create_security_group("test-sg, "Just making a point!")
# Define SG rules
ip_rules = [("tcp", 80, ""), ("tcp", 443, "")]
View gist:7849193
def expire_view_cache(view_name, args=None, kwargs=None, namespace=None, key_prefix=None, method="GET"):
This function allows you to invalidate any view-level cache.
view_name: view function you wish to invalidate or it's named url pattern
args: any arguments passed to the view function
namepace: optioal, if an application namespace is needed
key prefix: for the @cache_page decorator for the function (if any)
added: method to request to get the key generating properly