Skip to content

Instantly share code, notes, and snippets.

@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
#!/usr/bin/env python
'''
DEPENDENCIES:
$ brew install ffmpeg
$ brew install imagemagick
$ python ./mov2gif.py input.mov output.gif 15
'''
@ahmozkya
ahmozkya / README.md
Last active July 7, 2023 09:27
Homebrew with DNSMasq + DNSCrypt-proxy (OpenDNS)
@ryanlerch
ryanlerch / generate-gif-from-webm
Created May 1, 2014 14:47
Generates an Animated GIF from a webm
#!/bin/bash
echo "$1"
mkdir /tmp/"$1"/
gst-launch-1.0 filesrc location="$1" ! decodebin ! videoconvert ! pngenc ! multifilesink location="/tmp/$1/%04d.png"
echo "Trim files manually, and press enter to generate the GIF"
nautilus /tmp/"$1"/ &
read
echo "Generating GIF..."
convert -delay 5 /tmp/"$1"/*.png /tmp/"$1"/animation.gif
@creativcoder
creativcoder / gist:5dc5c2e35cd218ce9b5d
Last active August 22, 2022 14:41
Get list of installed packages(apps) in android via adb shell
Issue this command to terminal with your device connected :
$ adb shell pm list packages
If that doesn't work, then:
$ adb shell
$ su
$ pm list packages
@gcko
gcko / related.py
Last active August 7, 2023 09:32
Django Custom Model ForeignKey Field for Spanning Databases
@thomastweets
thomastweets / PNGWhiteTrim.py
Last active February 8, 2024 18:53
Python script to trim all png images with white background in a folder
import Image
import sys
import glob
import ImageOps
# Trim all png images with white background in a folder
# Usage "python PNGWhiteTrim.py ../someFolder"
try:
folderName = sys.argv[1]
@Alir3z4
Alir3z4 / utils.py
Created August 9, 2016 06:19
Create a hash of a file on upload time and save it for Django FileField/ImageField
def hash_file(file, block_size=65536):
hasher = hashlib.md5()
for buf in iter(partial(file.read, block_size), b''):
hasher.update(buf)
return hasher.hexdigest()
def upload_to(instance, filename):
"""
@gnilchee
gnilchee / docker-compose-consul.yml
Created October 28, 2016 06:04
Stand up a single node consul server and export ui/api over port 80 and consul dns over port 53
version: '2'
services:
consul:
image: consul
volumes:
- ./data/consul:/consul/data
command: /bin/consul agent -server -data-dir="/consul/data" -bootstrap -client="0.0.0.0" -advertise="127.0.0.1" -ui
ports:
- 80:8500 #HTTP API/UI
- 53:8600/udp #DNS
@mertcangokgoz
mertcangokgoz / tftpServer.sh
Last active January 19, 2023 04:28
macOS Sierra and Missing TFTP Server Management Tool
#!/bin/bash
# macOS Sierra TFTP Server Creator
# Author Mertcan GÖKGÖZ - 07.05.2017 15:00 (GMT +3)
#
# Requirements
# - Macos Sierra 10.12.4 and later
# - 'homebrew' package manager
# - brew install dialog
#
# How to use