Skip to content

Instantly share code, notes, and snippets.

View bozdoz's full-sized avatar
☠️
I may be dead

bozdoz bozdoz

☠️
I may be dead
View GitHub Profile
@bozdoz
bozdoz / admin.py
Created April 22, 2016 19:29
Django Admin : Action for Exporting User details to CSV
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
def export_to_csv (modeladmin, request, queryset):
import csv, StringIO
from django.core.servers.basehttp import FileWrapper
cols = ['username','email','first_name','last_name']
@bozdoz
bozdoz / map.geojson
Last active February 9, 2024 22:24
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bozdoz
bozdoz / createimages.py
Last active February 21, 2017 16:23
Automate icon/splashscreen creation for PhoneGap
'''
Given an SVG in the same directory ('./res/' by default),
iterates and creates new icons and splashscreens for
the PhoneGap Hello World Template
'''
import sys, os, subprocess
from PIL import Image
def createImages (logo_file_name = 'logo.svg', bg_color = '#ffffff', logo_name = 'project'):
@bozdoz
bozdoz / install-wp.sh
Created June 16, 2017 00:30
Wordpress Full Install
#!/bin/bash
rm latest.tar.gz
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
if [[ $1 ]]; then
mv wordpress $1
cd $1
else
@bozdoz
bozdoz / flatten.js
Created January 30, 2018 04:27
Recursively flattens nested arrays
/**
* Recursively flattens nested arrays
* ex: [[1,2,[3]],4] -> [1,2,3,4]
*
* @param Array arr
* @return Array
*/
const flatten = (arr) => (
// reduce will iterate and
// add to an array
@bozdoz
bozdoz / simple-html.js
Created February 1, 2018 22:51
HTML from Array of strings
/*
* utility variables for escaping HTML
*/
// escapeMap, borrowed from underscore.js
var escapeMap = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#x27;',
@bozdoz
bozdoz / pre-commit
Created July 10, 2018 18:30
Prevent commits on master branch (full relative path: .git/hooks/pre-commit)
#!/bin/bash
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
echo 'No pushing to master'
exit 1 # commit will not execute
else
@bozdoz
bozdoz / SketchSystems.spec
Created December 12, 2018 15:43
Upload Final Products
Upload Final Products
cancel -> No Organization
No Organization
choose organization -> Organization
Organization
No Subscription
choose subscription -> Subscription
Subscription
choose file -> File
@bozdoz
bozdoz / docker-compose.yml
Created December 19, 2018 16:17
Potential Expression Engine docker
version: '3.3'
services:
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_DATABASE: ee
MYSQL_USER: admin
@bozdoz
bozdoz / halifax.geojson
Last active October 17, 2020 02:47
Test Nested Properties
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.