Skip to content

Instantly share code, notes, and snippets.

View Sarverott's full-sized avatar
💭
I may be slow to respond.

Sett Sarverott Sarverott

💭
I may be slow to respond.
View GitHub Profile
@Sarverott
Sarverott / mysql.php
Last active January 16, 2018 03:03
simple function to connect with SQL server in PHP
<?php
function connect_db($host=false, $user=false, $pass=false, $database=false, $query='SELECT 1', $throw_error=true){
//defaults
if($host)$host='localhost';
if($user)$user='root';
if($pass)$pass=null;
$connection_object=null;
if($database){
//connect to server, directly to database
$connection_object=new mysqli($hosr,$user,$password,$database);
<h1>YOU ARE ON DASHBOARD PAGE</h1>
@Sarverott
Sarverott / hex-encoding.cpp
Created October 4, 2018 14:07
two simple functions to change hex cipher into decimal number and backwords
char decToHex(int n){
if(n<15||n>0){
switch(n){
case 10:
return 'a';
case 11:
return 'b';
case 12:
return 'c';
case 13:
<canvas id="autogrf" width="600" height="600"></canvas>
<script>
var lines=[
{
color:"#0000ff",
path:[
[false,53,88],
[false,83,88],
],
weight:1
#!/bin/bash
# CHANGE MAC ADDRESS
# ./mac-chg.sh {interface} {new mac}
# ~Sarverott
/etc/init.d/networking stop
ip link set $1 address $2
/etc/init.d/networking start
#!/bin/bash
# CREATE TOR HOST
# ./create-tor-host.sh {host port (np. 80)} {service address with port (np. 127.0.0.1:80)} {path to directory for service containment (np. /var/lib/tor/serv/http)}
# ~Sarverott
su
echo HiddenServiceDir $3 >>/etc/tor/torrc
echo HiddenServicePort $1 $2 >>/etc/tor/torrc
systermctl restart tor
clear
/*
Sett Sarverott
***~~~~~~~~***
plt tlp crypto functions
*/
class fibonacci{
constructor(){
this.last=1;
this.beforeLast=1;
}
@Sarverott
Sarverott / #random-string.v1.js
Last active February 5, 2022 19:00
function for generate customized random string. Works flowless in browser and with nodeJs
function randomString(len=9, matrix='qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM_-.#@'){
var ret='';
for(var i=0;i<len;i++){
ret+=matrix.charAt(Math.floor(Math.random()*matrix.length));
}
return ret;
}
@Sarverott
Sarverott / dna-random-examples-generator.js
Last active October 17, 2018 02:50
helper for molecular genetics
class DNA{
constructor(mode, config){
this.aminoAcidsArray=this.generateRandomDNA(config.len);
break;
}
generateRandomDNA(chainLength=20, allows=["A","C","G","T"]){
var tmp=[];
for(var i=0;i<chainLength;i++){
tmp.push(allows[Math.floor(Math.random()*allows.length)]);
}
@Sarverott
Sarverott / example.js
Last active November 25, 2018 22:11
simple node.js tcp client module
/*
USAGE:
*/
const tcpClient=require("./tcp-client.js");
var request=new tcpClient("192.168.0.1", 80);
request.setupConnectListener(function(){
console.log('connected to server!');
});
request.setupDataListener(function(data){
console.log(data);