Skip to content

Instantly share code, notes, and snippets.

View calind's full-sized avatar

Calin Don calind

View GitHub Profile
@calind
calind / build_qemu_debian_image.sh
Created January 14, 2023 22:04 — forked from sigmaris/build_qemu_debian_image.sh
Automate the installation of Debian Buster on a x86_64 QEMU 4.0.0 VM hosted on macOS
#!/bin/bash -e
if [ "$(uname -s)" != "Darwin" ]
then
echo "This script is for building a Debian x86_64 image to use on MacOS"
exit 1
fi
TEMP="$(mktemp -d build.XXXXX)"
cp preseed.cfg $TEMP
@calind
calind / slack.sh
Last active February 13, 2017 16:12
Send slack messages
#!/bin/bash
if [ -z "$SLACK_WEBHOOK" ] ; then
echo "No Slack webhook specified. export SLACK_WEBHOOK=..."
exit 1
fi
username=""
while getopts ":u:" opt; do
@calind
calind / mail.sh
Last active February 13, 2017 16:08
Simple email sending with sendgrid
#!/bin/bash
if [ -z "$SENDGRID_API_KEY" ] ; then
echo "No Sendgrid api key specified. export SENDGRID_API_KEY=..."
exit 1
fi
subject=""
from="$USER@$(hostname)"
#!/usr/bin/env python
import os, sys
sys.path.append(os.getcwd())
import logging
import rq
MAX_FAILURES = 3

Keybase proof

I hereby claim:

  • I am calind on github.
  • I am calind (https://keybase.io/calind) on keybase.
  • I have a public key whose fingerprint is 4B1D 1643 4829 B176 6158 B21F DD2D 07D7 5E8F 78F4

To claim this, I am signing this object:

BEGIN;
CREATE TABLE `auth_permission` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` varchar(50) NOT NULL,
`content_type_id` integer NOT NULL,
`codename` varchar(100) NOT NULL,
UNIQUE (`content_type_id`, `codename`)
)
;
ALTER TABLE `auth_permission` ADD CONSTRAINT `content_type_id_refs_id_d043b34a` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`);
@calind
calind / agent_type.conf
Created October 12, 2011 17:44
nginx user agent type detection (requires nginx >= 1.0.4)
# agent type detection, based on idea from from http://notnotmobile.appspot.com/
map $http_user_agent $agent_type_phase1 {
default 'mobile';
'' 'unknown';
~*iphone|ipod|blackberry|palm|windows\s+ce 'mobile';
~*windows|linux|os\s+[x9]|solaris|bsd 'desktop';
~*spider|crawl|slurp|bot|feedburner 'bot';
}
map $http_x_skyfire_phone $agent_type_phase2 {
default 'mobile';