Skip to content

Instantly share code, notes, and snippets.

@lexuzieel
lexuzieel / numpy_ma.py
Created March 12, 2020 00:33 — forked from rday/numpy_ma.py
Numpy moving average
import numpy as np
def moving_average(data_set, periods=3):
weights = np.ones(periods) / periods
return np.convolve(data_set, weights, mode='valid')
data = [1, 2, 3, 6, 9, 12, 20, 28, 30, 25, 22, 20, 15, 12, 10]
ma = moving_average(np.asarray(data), 3)
assert (np.around(ma, decimals=2)==np.array([2.0, 3.67, 6.0, 9.0, 13.67, 20.0, 26.0, 27.67, 25.67, 22.33, 19.0, 15.67, 12.33])).all() == True
#chatline {
display: none;
}
#chatwrap {
order: 2;
position: absolute;
top: 0;
margin: auto;
right: 0;
@lexuzieel
lexuzieel / OpenSimplexNoise.java
Created November 28, 2018 14:44 — forked from KdotJPG/OpenSimplex2S.java
Visually axis-decorrelated coherent noise algorithm based on the Simplectic honeycomb.
/*
* OpenSimplex Noise in Java.
* by Kurt Spencer
*
* v1.1 (October 5, 2014)
* - Added 2D and 4D implementations.
* - Proper gradient sets for all dimensions, from a
* dimensionally-generalizable scheme with an actual
* rhyme and reason behind it.
* - Removed default permutation array in favor of
@lexuzieel
lexuzieel / virtualbox.sh
Created September 25, 2018 20:28 — forked from vans163/virtualbox.sh
Virtualbox Commandline stuff
#Create storage
VBoxManage createhd --filename VMName.vdi --size 40000 --format VDI
VBoxManage modifyhd GoDial.vdi --resize 30500
VBoxManage list hdds
VBoxManage closemedium disk $(UUID) --delete
#Create VM
VBoxManage createvm --name "VMName" --ostype Windows7_64 --register
@lexuzieel
lexuzieel / vim-nginx-conf-highlight.sh
Created August 25, 2018 18:33 — forked from ralavay/vim-nginx-conf-highlight.sh
Enable syntax highlight for Nginx conf file in Vim
#!/bin/bash
#
# Highligh Nginx config file in Vim
# Download syntax highlight
mkdir -p ~/.vim/syntax/
wget https://raw.githubusercontent.com/nginx/nginx/release-1.11.10/contrib/vim/syntax/nginx.vim -O ~/.vim/syntax/nginx.vim
# Set location of Nginx config file
cat > ~/.vim/filetype.vim <<EOF
@lexuzieel
lexuzieel / installing_supervisor_macosx.md
Created August 13, 2018 16:44 — forked from fadhlirahim/installing_supervisor_macosx.md
Setting up supervisord in Mac OS X

Installation

Installing Supervisor on OS X is simple:

sudo pip install supervisor

This assumes you have pip. If you don't:

Install Supervisor with sudo apt-get install supervisor in Unix or brew install supervisor in Mac OSX. Ensure it's started with sudo service supervisor restart in Unix or brew services start supervisor in Mac OSX.

In Unix in /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini and in /usr/local/etc/supervisor.d/ create a .ini file. In this example, laravel_queue.ini (contents below). Give it execute permissions: chmod +x laravel_queue.ini.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread in Unix and with: brew services restart supervisor in MAc OSX . And start using those changes with: sudo supervisorctl update.

ffmpeg -i 11061145_0005.MP4 -c:a copy -c:v libx264 -crf 30 -vf scale=1920:-2:flags=lanczos -preset ultrafast 1080_11061145_0005.MP4
@lexuzieel
lexuzieel / .aliases
Created July 2, 2018 17:50
Shell aliases
# Git
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold white)<%an>%Creset' --abbrev-commit"
alias gs="git status"
alias ga="git add "
alias gaa="git add ."
alias gc="git commit -m "
alias gcom="git checkout master"
alias gco="git checkout"
# Composer
@lexuzieel
lexuzieel / BigEndianBinaryReader.cs
Created February 20, 2018 21:53
Simple implementation of a big-endian BinaryReader in C#.
using System;
using System.IO;
using System.Text;
namespace ProjectZomboidThing
{
class BigEndianBinaryReader : BinaryReader
{
public BigEndianBinaryReader(Stream input) : base(input)
{