Skip to content

Instantly share code, notes, and snippets.

@protrolium
protrolium / terminal-gif.md
Last active February 15, 2024 09:09
convert images to GIF in Terminal

Install ImageMagick

brew install ImageMagick

Pull specific region of frames from video file w/ ffmpeg

ffmpeg -ss 14:55 -i video.mkv -t 5 -s 480x270 -f image2 %04d.png

  • -ss 14:55 gives the timestamp where I want FFmpeg to start, as a duration string.
  • -t 5 says how much I want FFmpeg to decode, using the same duration syntax as for -ss.
  • -s 480x270 tells FFmpeg to resize the video output to 480 by 270 pixels.
  • -f image2 selects the output format, a series of still images — make sure there are leading zeros in filename.

How to Setup emacs irony-mode in Ubuntu-12.04

I recently found a nice emacs-mode, [irony-mode], which can be used with [company-mode], [flycheck-mode], and [eldoc-mode]. It works nicely with CMake-based projects. The document contains a list of instructions for setting things up. I assume that you're using a fresh-installed Ubuntu-12.04.5 (64-bit). It uses [Lean theorem prover][lean] as an example project.

@amatellanes
amatellanes / celery.sh
Last active April 19, 2024 11:31
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@Nagyman
Nagyman / workflows-in-django.md
Last active January 27, 2024 08:29
Workflows in Django

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
@XVilka
XVilka / TrueColour.md
Last active April 8, 2024 14:02
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@destan
destan / text2png.py
Last active January 10, 2024 06:32
Python text to image (png) conversion with automatic new line calculation
# coding=utf8
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def text2png(text, fullpath, color = "#000", bgcolor = "#FFF", fontfullpath = None, fontsize = 13, leftpadding = 3, rightpadding = 3, width = 200):
REPLACEMENT_CHARACTER = u'\uFFFD'
NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' '
@alexott
alexott / cedet-1.1-startup.el
Created October 28, 2012 13:42
Working configuration for CEDET 1.1 & below (only separate releases, not included into GNU Emacs)
;;; cedet-1.1-startup.el --- Working configuration for CEDET 1.1 & below
;; Copyright (C) Alex Ott
;;
;; Author: Alex Ott <alexott@gmail.com>
;; Keywords: CEDET 1.1,
;; Requirements: CEDET 1.1 or below
(load-file "~/tmp/cedet-1.1/common/cedet.el")
(require 'semantic-decorate-include)
@alexott
alexott / minimial-cedet-config.el
Created October 22, 2012 07:30
Working configuration for CEDET from bzr & GNU Emacs (with working C++ & Java name completion)
;;; minimial-cedet-config.el --- Working configuration for CEDET from bzr
;; Copyright (C) Alex Ott
;;
;; Author: Alex Ott <alexott@gmail.com>
;; Keywords: cedet, C++, Java
;; Requirements: CEDET from bzr (http://cedet.sourceforge.net/bzr-repo.shtml)
;; Do checkout of fresh CEDET, and use this config (don't forget to change path below)
@hideaki-t
hideaki-t / sqlite_fts_tokenizer.py
Created August 18, 2012 20:59
a proof of concept implementation of SQLite FTS tokenizers in Python
# coding: utf-8
"""
a proof of concept implementation of SQLite FTS tokenizers in Python
"""
from __future__ import print_function, unicode_literals
import sys
import ctypes
from ctypes import POINTER, CFUNCTYPE
import struct
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""