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
start := time.Now()
elapsed := time.Since(start)
for {
elapsed = time.Since(start)
start = time.Now()
time.Sleep(time.Duration(1000) * time.Millisecond)
}
@kevsersrca
kevsersrca / problem.md
Created June 8, 2018 22:41
APT-GET problem

Problem :

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
@kevsersrca
kevsersrca / replace.go
Last active May 28, 2018 15:04
testing replace in go
package main
import (
"io/ioutil"
"strings"
)
func replace(path string, oldValue string, newValue string) {
read, err := ioutil.ReadFile(path)
@kevsersrca
kevsersrca / error.md
Created April 27, 2018 13:15
php -v error
php -v 

dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  Referenced from: /usr/local/opt/[email protected]/bin/php
  Reason: image not found
[1]    8791 abort      composer install

sudo ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/opt/jpeg/lib/libjpeg.8.dylib`

This file has been truncated, but you can view the full file.
CREATE SEQUENCE Areas_seq;
CREATE TABLE IF NOT EXISTS Areas (
AreaID int NOT NULL DEFAULT NEXTVAL ('Areas_seq'),
CountyID int NOT NULL,
AreaName varchar(100) NOT NULL,
PRIMARY KEY (AreaID)
) ;
ALTER SEQUENCE Areas_seq RESTART WITH 2438;
QEMU - 52:54:00
VMWare - 00:50:56
Xen Source - 00:16:3E
Xen - 00:ca:fe
Microsoft - 00:15:5D
@kevsersrca
kevsersrca / convert.go
Created April 13, 2018 13:09
convert byte[size] to string
data := []byte("testing")
b := md5.Sum(data)
//this is mostly invalid characters
fmt.Println(string(b[:]))
pass := hex.EncodeToString(b[:])
fmt.Println(pass)
// or
pass = fmt.Sprintf("%x", b)
@kevsersrca
kevsersrca / removelines.go
Created April 13, 2018 08:11
remove lines between start and n
package main
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"os"
)
@kevsersrca
kevsersrca / ssl.md
Created April 11, 2018 14:59
Websocket traffic with ssl

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto


./certbot-auto certonly --standalone --email [email protected] -d yourdomain.com


mkdir /srv/blynk-data
@kevsersrca
kevsersrca / cxs.sh
Last active April 11, 2018 14:59
cxs setup
kontrol=`wget -qO - - http://license.configserver.com/cgi-bin/cxs/check.cgi | awk {'print $1'}`
if [[ $kontrol == "Invalid" ]]; then
echo -e "CXS License Not Found"
elif [[ $kontrol != "Invalid" ]]; then
wget https://download.configserver.com/cxsinstaller.tgz
tar -xzf cxsinstaller.tgz
perl cxsinstaller.pl
rm -fv cxsinstaller.*