Skip to content

Instantly share code, notes, and snippets.

View nektro's full-sized avatar
🌻
if you know, you know

Meghan Denny nektro

🌻
if you know, you know
View GitHub Profile
<?php
/**
* A little php script to accept images and make folders based on the hash,
* with a bonus _ folder at the end to detect if collisions occur.
*
* For example, using a form on this page would convert the following image
* https://dev.nektro.net/assets/nektro.png
* http://localhost/imgh/cdn/89/9e/84/39/49/12/16/7a/06/c7/b1/ae/c5/18/e5/3b/d7/8e/b6/a5/eb/7d/29/9e/cf/fa/ec/63/51/d8/19/1b/_0/c.png
*/
$home_dir = '/imgh/';
@nektro
nektro / web_view.php
Last active November 18, 2020 21:14
Open a TCP socket and create a handmade HTTP 1.1 GET request
<?php
/**
* Connect to an HTTP server and echo the response
*/
$host = 'localhost';
$port = 80;
$fp = fsockopen($host, $port, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
}
@nektro
nektro / css.css
Last active September 17, 2022 06:02
Yaml Css Preprocess
.head {
height: 32px;
font-size: 16px;
line-height: 32px
}
.head ul {
margin: 0
}
.head ul li {
list-style-type: none;
<?php
function convBase($numberInput, $fromBaseInput, $toBaseInput)
{
if ($fromBaseInput==$toBaseInput) return $numberInput;
$fromBase = str_split($fromBaseInput,1);
$toBase = str_split($toBaseInput,1);
$number = str_split($numberInput,1);
$fromLen=strlen($fromBaseInput);
$toLen=strlen($toBaseInput);
$numberLen=strlen($numberInput);
@nektro
nektro / Lifinator.java
Last active April 13, 2016 03:18
Turn images into life files
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Lifeinator
{
public static void main(String[] args)
@nektro
nektro / custom_element.html
Created January 14, 2017 07:18
access the dom inside html imports
<script>
const importDoc = document.currentScript.ownerDocument;
</script>
@nektro
nektro / CoolioVirus.java
Last active January 28, 2017 05:32
Coolio Albainian Virus meme
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class CoolioVirus
{
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
{
String title = "Virus Alert !";
String message = "Hi, I am an Albanian virus but because of poor technology in my\n" +
@nektro
nektro / install_composer.sh
Created July 9, 2017 02:29
Installer shell scripts
#!/usr/bin/env bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
@nektro
nektro / bin2.js
Last active October 16, 2017 02:25
algorithm 3.2
function bin2(n, k)
{
const B = new Array(n+1).fill(0).map((x) => {
return new Array(k+1).fill(0);
});
for (let i = 0; i <= n; i++) {
for (let j = 0; j <= Math.min(i,k); j++) {
if (j === 0 || j === i) {
B[i][j] = 1;
@nektro
nektro / bs4-accordion.html
Created October 11, 2017 00:34
Bootstrap 4 Accordion Custom Element w/ Corgi Example
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<script defer src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script defer src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<template id="template-bs4-accordion-item">
<div class="card">
<div class="card-header" role="tab" id="headingOne">
<h5 class="mb-0">
<a data-toggle="collapse"