Skip to content

Instantly share code, notes, and snippets.

View BonfaceKilz's full-sized avatar
💭
Scheme-ing ❤️

BonfaceKilz BonfaceKilz

💭
Scheme-ing ❤️
View GitHub Profile
@BonfaceKilz
BonfaceKilz / laravelPermissions.md
Last active March 20, 2018 12:32
Setting proper laravel permissions. Otherwise, server will be down

If you don't set permissions right, your server will be down. If too restrictive, i.e. your server(e.g nginx or apache) has no write permissions for some things, content won't be served. If too liberal, you will pawned and alot of bad things will maybe happen. Here's how I set the permissions(should be added to playbooks if possible).

There are 2 ways of setting up the permissions:

  1. Make webserver owner of all files [Recommended]
  2. Giving yourself ownership

1. Make webserver owner of all files

sudo chown -R www-data:www-data /path/to/dir
@BonfaceKilz
BonfaceKilz / labels.m
Created December 3, 2017 20:15
The Simulink scope block does not support the manipulation of graphics properties in scope displays. To add labels to the block, the following snippet of Matlab code is used
shh = get(0, 'ShowHiddenHandles');
set(0, 'ShowHiddenHandles', 'On');
set(gcf, 'menubar', 'figure');
set(gcf, 'CloseRequestFcn', 'closereq');
set(gcf, 'DefaultLineClipping', 'Off');
set(0, 'ShowHiddenHandles', shh);
@BonfaceKilz
BonfaceKilz / i3config
Created September 24, 2017 06:21
My i3 config file
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@BonfaceKilz
BonfaceKilz / capture.js
Created September 19, 2017 09:50
Testing the responsiveness of a website in an array of different screen sizes.
/*
requires: phantomjs, async
usage: phantoms capture.js
*/
var site = 'http://localhost:3000/index.html';
var async = require('async'),
sizes = [
[320, 480], //iphone
[384, 640], //LG Optimus
@BonfaceKilz
BonfaceKilz / tmux-cheatsheet.markdown
Created July 5, 2017 11:58 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@BonfaceKilz
BonfaceKilz / curltest.c
Created June 4, 2017 20:06
A program that uses libcurl to fetch data in JSON format. Later parsed with json-c
/**
* A demo of how to get data from a website in JSON format
* I'll get data from this site:
* http://jsonplaceholder.typicode.com/posts
*
* Requirements:
*
* json-c - https://github.com/json-c/json-c
* libcurl - http://curl.haxx.se/libcurl/c
*
@BonfaceKilz
BonfaceKilz / i3_reference.md
Last active April 17, 2017 21:39
i3 Cheatsheet

Basics

$mod + : Open new terminal
$mod + j : Focus Left
$mod + k : Focus down
$mod + l : Focus up
$mod + ; : Focus right
$mod + : toggle focus mode

Moving Windows

Keybase proof

I hereby claim:

  • I am BonfaceKilz on github.
  • I am bonfacemunyoki (https://keybase.io/bonfacemunyoki) on keybase.
  • I have a public key whose fingerprint is D4F0 9EB1 1017 7E03 C28E 2FE1 F5BB AE1E 0392 253F

To claim this, I am signing this object:

@BonfaceKilz
BonfaceKilz / emacsclient.md
Created March 29, 2017 21:46
Setting up emacsclient

Add the following to your .bashrc file:

# Emacs config
export ALTERNATE_EDITOR=emacs EDITOR=emacsclient VISUAL=emacsclient
# Set an alias
alias ec="emacsclient"

Add the following to your ~/.config/systemd/user/emacs.service file:

[Unit]
@BonfaceKilz
BonfaceKilz / video_manipulation.md
Last active March 14, 2017 08:07
Speeding up and boosting video using ffmpeg

To speed up you video from 1x to 5x, you can type:

ffmpeg -i <input_video> -vf "setpts=0.2*PTS" -an <output video>

To speed up both video and audio:

ffmpeg -i input.mkv -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mkv

To increase volume output, use the -vol switch of FFmpeg like so: