Skip to content

Instantly share code, notes, and snippets.

@IrSent
IrSent / celery.py
Created November 12, 2016 19:12
Celery Best Practices
# Safe Queue Celery App Settings
from __future__ import absolute_import, unicode_literals
from celery import Celery
app = Celery('some_project',
broker='amqp://',
backend='amqp://',
include=['some_project.tasks'])
(https://forums.docker.com/t/cleaning-up-docker-for-mac/17894)
ls -lh ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
docker run -it --rm -v /:/host alpine chroot /host /bin/sh -c 'dd if=/dev/zero of=/var/lost+found/zeroes; rm /var/lost+found/zeroes'
cd ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux
/Applications/Docker.app/Contents/MacOS/qemu-img convert -p -O qcow2 Docker.qcow2 Docker-slim.qcow2
mv Docker-slim.qcow2 Docker.qcow2
@paoloantinori
paoloantinori / keycloak.sh
Created January 26, 2016 15:59
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@bjhaid
bjhaid / all_elixir_auto_complete.bash
Last active March 25, 2017 10:29
Bash Auto Completion for elixir
_mix()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [[ ! -f /tmp/__mix_completion__ ]]; then
opts=$(for i in `mix help | grep -ve "current:" | grep -ve "iex" | awk '{ print $2" " }'`; do echo $i; done);
echo $opts > /tmp/__mix_completion__;
else
import path from 'path';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
const PORT = process.env.PORT || 8888;
const HOST = process.env.HOST || 'localhost';
const config = {
entry: {
app: [
@martinrusev
martinrusev / cron_supervisord.ini
Last active June 1, 2024 03:27
Cron supervisord
[supervisord]
nodaemon=true
loglevel=debug
[program:amon]
command=gunicorn -c gunicorn.conf.py wsgi
directory=/amon
autostart=true
autorestart=true
redirect_stderr=true
@MohamedAlaa
MohamedAlaa / ImageMagick-snippets.md
Last active April 13, 2024 21:53
ImageMagick Snippets

Remove white background color of an image in ImageMagick

$ convert  your.jpg  -transparent white  your.png

Flatten a transparent image with a white background:

@peihsinsu
peihsinsu / gce-snapshot.sh
Created September 19, 2014 13:38
GCE daily scheduling snapshot backup
#!/bin/bash
# Environments
export PATH=/root/google-cloud-sdk/bin:$PATH
# Daily create snapshot for "backup_path" listed disks
# And remove snapshot 1 week old before
# Create snap date
export DT=`date +%Y%m%d`
@denji
denji / http-benchmark.md
Last active July 18, 2024 09:01
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@alanhamlett
alanhamlett / api.py
Last active June 28, 2024 08:15
Serialize SQLAlchemy Model to dictionary (for JSON output) and update Model from dictionary attributes.
import uuid
import wtforms_json
from sqlalchemy import not_
from sqlalchemy.dialects.postgresql import UUID
from wtforms import Form
from wtforms.fields import FormField, FieldList
from wtforms.validators import Length
from flask import current_app as app
from flask import request, json, jsonify, abort