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 / gist:877e8318c8684d953cbb496a300c7a8b
Last active January 5, 2018 10:46
virtualbox Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
CENTOS_BOX="serveit/centos-7"
UBUNTU_BOX="generic/ubuntu1710"
DEBIAN_BOX="generic/debian9"
SH_FILE="/root/install.sh"
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
@kevsersrca
kevsersrca / gist:1738cb9bbb130554899ed5adb4c728e7
Created December 10, 2017 12:50
Mysql new root create with remote connectedly
CREATE USER 'new_root'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO new_root@'%' IDENTIFIED BY 'password' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
package main
import (
"encoding/xml"
"fmt"
"time"
"github.com/astaxie/beego/httplib"
)
class BinarySourceTree<T> where T:IComparable
{
/* BİNARY SOURCE TREE
___ ___________ ____
| | | |
| | | |
| | | |
| | | |
| | ROOT | |
| | | |
Virtualenv
sudo pip install virtualenv
or
sudo apt-get install python-virtualenv
in the project
virtualenv venv
. venv/bin/activate
after install Flask
@kevsersrca
kevsersrca / gist:5ba1e1cbf8e2befb367d27723a6ce95b
Created September 18, 2017 13:00
Proxmox KVM Shutdown VM quit/powerdown failed - got timeout
ps aux | grep "/usr/bin/kvm -id VMID"
kill -9 PID
qm start VMID
qm list
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
@kevsersrca
kevsersrca / gist:fdb0072e8a897f666a2ab29045958639
Last active August 11, 2017 11:14
first day and end day on month
def firstOfMonth(day):
resultDate = day.replace(day=1)
if ((day - resultDate).days > 25):
resultDate = resultDate + relativedelta(months=1)
return resultDate
def lastOfMonth(any_day):
next_month = any_day.replace(day=28) + datetime.timedelta(days=4) # this will never fail
$collection = app(Post::class);
//if tags
$collection = $collection->
whereHas('tags', function ($query) use ($t) {
$query->where('tag_id','=', $t);
});
//if languages
$collection = $collection->whereHas('languages', function ( $query ) use ( $l ){
$query->where('language_id', '=',$l);