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
package main
import (
"fmt"
"regexp"
"strings"
)
func Reverse(s string) string {
runes := []rune(s)
@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>
func isInside(adress string, masks []string, timeout time.Duration, done chan net.IP) {
c1 := make(chan net.IP)
c2 := make(chan error)
var p net.IP
var err error
go func() {
ipv4 := adress
p = net.ParseIP(ipv4).To4()
@kevsersrca
kevsersrca / gist:c89b778646b2e081b07e33ca21b2396e
Created February 23, 2018 07:44
command not found hatası
export PATH=$PATH:$(go env GOPATH)/bin
public function cleanUrl($url) {
if (strpos($url, 'https://') > -1) {
$clean = array_filter(explode("https://", $url));
return $this->cleanUrl($clean[1]);
}
if (strpos($url, 'http://') > -1) {
$clean = array_filter(explode("http://", $url));
return $this->cleanUrl($clean[1]);
}
if (strpos($url, "/") > -1) {
@kevsersrca
kevsersrca / gist:e55bb8fa933e7665ee08e51af022aecc
Created March 1, 2018 14:48
Digitalocean droplets list
package main
import (
"fmt"
"log"
"net"
"time"
"github.com/digitalocean/go-qemu/hypervisor"
)
@kevsersrca
kevsersrca / go snmp
Last active September 13, 2019 11:12
Golang Snmp Trials 🐰
package main
import (
"log"
"net"
"time"
"gopkg.in/errgo.v1"
"github.com/posteo/go-agentx"
# pip install pytelegrambotapi --upgrade
import telebot
bot = telebot.TeleBot("")
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
if message.chat.type == "private":
bot.reply_to(message, str(bot.get_me()))
if message.chat.type == "channel":
- [ sed, -i, -r, "s/PermitRootLogin prohibit-password/PermitRootLogin yes/g", /etc/ssh/sshd_config ]
- [ service, ssh, restart ]
@kevsersrca
kevsersrca / gist:dcea7c1313cca382511c1addfb918751
Created March 14, 2018 13:37
External snapshot delete problem
virsh snapshot-delete domain --metadata snapshot-name