Skip to content

Instantly share code, notes, and snippets.

@danielmahal
danielmahal / removeduplicateframes.sh
Created March 6, 2017 21:43
Remove duplicate frames from video with ffmpeg and mpdecimate
ffmpeg -i input.mov -vf mpdecimate,setpts=N/FRAME_RATE/TB output.mov
@resting
resting / gist:3421760
Created August 22, 2012 02:41 — forked from RiANOl/gist:1077723
AES128 encrypt/decrypt in PHP with base64
<?
function aes128Encrypt($key, $data) {
if(16 !== strlen($key)) $key = hash('MD5', $key, true);
$padding = 16 - (strlen($data) % 16);
$data .= str_repeat(chr($padding), $padding);
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC, str_repeat("\0", 16)));
}
function aes128Decrypt($key, $data) {
@streslab
streslab / Headless_Ethereum_Ubuntu_16.04.md
Last active April 4, 2022 23:45
Headless NVIDIA overclock setup under Ubuntu Server 16.04 for ethereum mining

Headless Ethereum Miner Setup - NVIDIA

Reed Slaby, March 2018

Having grown tired of wasting a perfectly good monitor on my ethereum mining rig, I finally decided to replace the Ubuntu Desktop 16.04 installation with Ubuntu Server 16.04. Many of the gtutorials available at the time of this writing range from unecessarily complicated to flat-out wrong. This guide is intended to address many of those shortfalls.

Prerequisites

To complete this guide, you should already have:

  • Basic knowledge of Linux
  • An Ethereum wallet
@1player
1player / list-unused-flatpak-directories.sh
Created June 14, 2022 09:14
Show all unused ~/.var/app directories from uninstalled Flatpaks, and their size
#!/bin/bash
set -euo pipefail
base_dir=$(realpath $HOME/.var/app --relative-to=$(pwd))
comm -13 <(flatpak list --columns=application | sort) <(ls -1 $HOME/.var/app/ | sort) \
| sed "s#^#$base_dir/#" | tr '\n' '\0' | du -sch --files0-from=-
@superblaubeere27
superblaubeere27 / GLSLSandboxShader.java
Last active February 25, 2023 18:04
GLSLSandbox Renderer, compatible with LWJGL 2 - 3 (compatible for minecraft)
/*
* Copyright (c) superblaubeere27 2020
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOF
@n8allan
n8allan / libpsresample.cpp
Created March 15, 2023 17:17
Interface for the Raspberry Pi Broadcom ISP (/dev/video12) via V4L2 M2M
#include <stdio.h>
#include <stdlib.h>
#include <memory>
#include <cstring>
#include <vector>
#include <string.h>
#include <assert.h>
#include <getopt.h> /* getopt_long() */
#include <fcntl.h> /* low-level i/o */
@chipolux
chipolux / embedded_window.py
Created August 22, 2017 23:27
Embedding A Window In A Widget (PyQt5 and python-xlib)
def get_window_id(name):
import Xlib.display
d = Xlib.display.Display()
r = d.screen().root
window_ids = r.get_full_property(
d.intern_atom('_NET_CLIENT_LIST'), Xlib.X.AnyPropertyType
).value
@ForgottenUmbrella
ForgottenUmbrella / publish_python.md
Last active December 25, 2023 21:49
How to publish Python apps for human beings

How to publish Python apps for human beings

So, you've created a Python app (be it a graphical user interface with Qt or the like, or a simple command line interface). Great! But how are others going to use it? Python applications often have dependencies (e.g. from third-party modules), and they also need a Python interpreter to run them. For a developer, installing all the necessary bits and bobs to make things work is okay, but that's unacceptable for a normal user - they just want to download the thing and run it.

Below are simple instructions to publish your app on the three main operating systems: Windows, macOS and Linux.

@rossant
rossant / glwidget.py
Created November 26, 2018 17:14
Minimal modern PyQt5, OpenGL, QOpenGLWindow working example
#!/usr/bin/env python3
"""
Code from http://www.labri.fr/perso/nrougier/python-opengl/#the-hard-way
"""
import ctypes
import logging
@ssokolow
ssokolow / x11_watch_active_window.py
Last active February 6, 2024 22:50
python-xlib example which reacts to changing the active window
#!/usr/bin/env python
"""python-xlib example which reacts to changing the active window/title.
Requires:
- Python
- python-xlib
Tested with Python 2.x because my Kubuntu 14.04 doesn't come with python-xlib
for Python 3.x.