Skip to content

Instantly share code, notes, and snippets.

View autioch's full-sized avatar

Jakub Szczepaniak autioch

  • Poznań, Poland
View GitHub Profile
@autioch
autioch / scan.js
Created July 21, 2024 16:03
Scan your local network for active services
const http = require('http');
const net = require('net');
const PORTS_TO_SCAN = [80, 443, 22, 21, 8080];
const scanService = (i, port) => new Promise((resolve) => {
const ip = `192.168.1.${i}`;
const socket = new net.Socket();
socket.setTimeout(4000);
socket.on('connect', () => {
@autioch
autioch / index.html
Last active July 25, 2023 19:33
Millimeter paper creator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html,
body {
(() => {
function Person (userName) {
this.userName = userName;
this.present = function () {
console.log(`Hi, I'm ${this.userName}`);
}
this.greet = function(person){
@autioch
autioch / qbWebForm.class.php
Created November 7, 2017 19:21
Single class for creating, generating and evaluating HTML forms.
<?php
/* 1.1.1 */
/**
* Single class for creating, generating and evaluating HTML forms.
*/
class qbWebForm
{
public $id;
@autioch
autioch / SqlAdmin.php
Created November 7, 2017 19:20
One file database admin
<!doctype html>
<html>
<head>
<title>Database Administration</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
<style>
body {width:96%; margin:auto; margin-top:10px; border:auto; padding:auto; font-size:13px; color:#005000; text-align:center;font-family:Helvetica,Arial;background-color:#ffffff;}
a {font-weight:bold; text-decoration:none; color:#005000; }
a.hover {font-weight:bold; text-decoration:underline; color:#005000; }
a.active {font-weight:bold; text-decoration:none; color:#005000; }
@autioch
autioch / thumbGenerator.php
Created November 7, 2017 19:02
Create thumbnails of images in given directory
<?php
$imageFolder = '.';
$extensions = 'jpg,JPG,JPEG,jpeg,png,PNG'; //can be just 'all' as well.
$width = 150;
$height = 150;
/**
* Filters out thumbnails.
*
@autioch
autioch / stringifyFunction.js
Created September 17, 2017 17:49
Stringify function
module.exports = function stringifyFunction(obj) {
return JSON.stringify(obj, (key, value) => {
if (typeof value === 'function') {
return `[Function ${value.name}]`;
}
return value;
}, ' ');
};
@autioch
autioch / stringifyCircular.js
Created September 17, 2017 17:49
Stringify circular
module.exports = function stringifyCircular(obj) {
const cache = [];
return JSON.stringify(obj, (key, value) => {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Circular reference found, discard key
return undefined;
}
@autioch
autioch / webpack.config.js
Last active June 21, 2017 19:34
Webpack 1 generic config
/*
npm i -S webpack@1 html-webpack-plugin clean-webpack-plugin extract-text-webpack-plugin@1 webpack-livereload-plugin
npm i -S css-loader file-loader postcss-loader@1 style-loader sass-loader node-sass autoprefixer
npm i -S babel-core babel-loader babel-preset-es2015
npm i -S template-minify-loader
npm i -S eslint-plugin-react preact babel-plugin-transform-react-jsx
npm i -D eslint eslint-config-qb serve-local
*/
@autioch
autioch / dateTypes.js
Created May 20, 2017 08:44
Date methods
/* eslint no-inline-comments: 0 */
/* eslint line-comment-position: 0 */
/* eslint no-unused-expressions: 0 */
// Object.getOwnPropertyNames(Date);
Date.length; // 7 - number
Date.name; // Date - string
Date.arguments; // null - object
Date.caller; // null - object