Skip to content

Instantly share code, notes, and snippets.

View kevsersrca's full-sized avatar
🚀
Working from home

kev kevsersrca

🚀
Working from home
View GitHub Profile
@kevsersrca
kevsersrca / cumsum.m
Created March 28, 2018 22:30 — forked from barisesen/cumsum.m
matlab cumsum function source code !
function X = cumSumFunc(image)
[m,n] = size(image);
X = zeros(m,n);
X(1,:) = image(1,:);
for i=2:m
for j=1:n
X(i,j) = image(i,j) + X(i-1,j);
end
end
end
@kevsersrca
kevsersrca / ipint.go
Created March 23, 2018 12:56 — forked from ammario/ipint.go
Golang ip <-> int conversion
func ip2int(ip net.IP) uint32 {
if len(ip) == 16 {
return binary.BigEndian.Uint32(ip[12:16])
}
return binary.BigEndian.Uint32(ip)
}
func int2ip(nn uint32) net.IP {
ip := make(net.IP, 4)
binary.BigEndian.PutUint32(ip, nn)
@kevsersrca
kevsersrca / libvirt-network-filter.xml
Created February 6, 2018 08:17 — forked from wido/libvirt-network-filter.xml
Simple Network Filter for libvirt
<filter name='network_filter_1' chain='ipv4' priority='-700'>
<uuid>64b80046-9a9d-40c2-8782-ed5878146262</uuid>
<rule action='drop' direction='out' priority='500'>
<mac match='no' srcmacaddr='52:54:00:01:ad:9d'/>
</rule>
<rule action='return' direction='out' priority='500'>
<ip srcipaddr='192.168.100.101'/>
</rule>
@kevsersrca
kevsersrca / virt-install-centos
Created January 24, 2018 15:15 — forked from giovtorres/virt-install-centos
Install CentOS cloud images on KVM using cloud-init
#!/bin/bash
## **Updates to this file are now at https://github.com/giovtorres/kvm-install-vm.**
## **This updated version has more options and less hardcoded variables.**
# Take one argument from the commandline: VM name
if ! [ $# -eq 1 ]; then
echo "Usage: $0 <node-name>"
exit 1
fi
@kevsersrca
kevsersrca / .eugene_aliases.bash
Created August 1, 2017 10:58 — forked from kn9ts/.eugene_aliases.bash
.eugene_mutai.bash
# alias hub (installed with brew to sugar up git) as git
alias git=hub
# sublime aliasing
alias sb=subl
# ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
# other good aliases
alias sites='cd ~/Sites'
alias play="cd ~/Development/playground"
@kevsersrca
kevsersrca / composer_lower_section.json
Created August 1, 2017 10:41 — forked from kn9ts/composer_lower_section.json
Key parts in deploying a laravel application to dokku: composer.json
{
"scripts": {
"post-install-cmd": [
"php artisan optimize",
"chmod -Rvc 777 app/storage",
"chmod -R 777 public",
"php artisan cache:clear",
"php artisan migrate"
],
"post-update-cmd": [
@kevsersrca
kevsersrca / dokku-vagrant-laravel-app
Created August 1, 2017 10:37 — forked from dhovart/dokku-vagrant-laravel-app
Simple steps to set up a Laravel app on dokku in a Vagrant box
# --------------------------------------------------
# Setting up a Laravel app on dokku in a Vagrant box
# --------------------------------------------------
# First: cloning the dokku repo
$ git clone https://github.com/progrium/dokku
$ cd dokku
# Start, configure & provision a new vagrant box using the Vagrantfile from the repo
$ vagrant up
Post::whereHas('tags', function ($query) use ($t) {
$query->where('tag_id','=', $t);
})->whereHas('languages', function ( $query ) use ( $l ){
$query->where('language_id', '=',$l);
})->orWhere(function ($q) use ($search) {
$q->where('title', 'LIKE', '%' . $search . '%')
->orWhere('explanation','LIKE','%'.$search.'%')
->orWhere('usage','LIKE','%'.$search.'%')
->orWhere('codeexample','LIKE','%'.$search.'%')
->orderBy('id','desc');