Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import math
import sys
from moviepy.editor import AudioClip, VideoFileClip, concatenate_videoclips
# Get average RGB of part of a frame. Frame is H * W * 3 (rgb)
# Assumes x1 < x2, y1 < y2
@enricofoltran
enricofoltran / main.go
Last active September 30, 2025 12:29
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@wellington1993
wellington1993 / Generate Self Signed A1 Certificate.txt
Last active May 17, 2023 14:14
Generate Self Signed A1 Certificate
openssl genrsa 2048 > private.pem
openssl req -x509 -new -key private.pem -out public.pem
openssl pkcs12 -export -in public.pem -inkey private.pem -out mycert.pfx
@John-Lin
John-Lin / simple_loop.py
Last active November 6, 2025 12:39
Mininet Simple Topology
#!/usr/bin/python
from mininet.topo import Topo
from mininet.cli import CLI
from mininet.net import Mininet
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel
from mininet.node import RemoteController
@gaearon
gaearon / AudioPlayer.jsx
Created October 31, 2014 22:13
React <audio> wrapper
/** @jsx React.DOM */
'use strict';
var React = require('react'),
{ PropTypes } = React;
var AudioPlayer = React.createClass({
propTypes: {
source: PropTypes.string.isRequired,
isPlaying: PropTypes.bool.isRequired,
@kontikidigital
kontikidigital / tgt-magento-subscribers.php
Last active March 2, 2018 14:41
Export Magento Newsletter Subscribers
<?php
/*
Extension Name: Magento CSV Export Newsletter Subscribers
Description: Export a list of subscribers of the Magento Newsletter in CSV format
Version: 0.1
License: GPL
Author: TargetIMC
Author URI: http://targetimc.com
*/
/* Paste this file in root directory and run it manually*/
@maxk42
maxk42 / website.go
Last active January 16, 2022 01:08
Serving static and dynamic content together in golang
// This assumes your web app is running in a directory which has a subdirectory named 'public/' and
// that there is an 'img/' subdirectory in 'public/' containing an image named 'kitten.jpg'
package main
import (
"fmt"
"net/http"
)
@hengxin
hengxin / How to install Cassandra on Ubuntu?.markdown
Last active May 20, 2020 20:24
How to install Cassandra on Ubuntu?

0. Overview

This article aims to be a portal to installation and configuration of Cassandra. It is self-contained in the first place. It also provides links to the original articles.

Warning: This article is still under written.

Prerequisites

Install Oracle Java Development Kit (JDK)

@liyonghelpme
liyonghelpme / demo.go
Last active April 28, 2016 21:22
golang http proxy
package main
import (
"flag"
"log"
"net/http"
"strings"
"unicode"
"io/ioutil"
//"os"
)
// Package float10 implements decimal floating point numbers
// using uint64 to hold the coefficient.
package float10
import "strconv"
import "errors"
import "strings"
import "math"
// value is -1^sign * coef * 10^exp