Skip to content

Instantly share code, notes, and snippets.

View MINORITYmaN's full-sized avatar

Stefano Kocka MINORITYmaN

  • Europe
View GitHub Profile
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@lolindirfaelivrin
lolindirfaelivrin / php_perumtaion.php
Created May 3, 2012 08:50
PHP: Php string permutation
<?php
/**
* Permutations
*
* Returns an array of strings containing all the
* ($alphabet ^ $output_length) permutations
*
* @alphabet (string|array) set of at least two elements to choose from
* @output_length (int) the number of elements in each output string
*
@jonathantneal
jonathantneal / Math.between.js
Created July 31, 2012 18:03
Math.between // returns whether a number is between two numbers
Math.between = function (n1, n2, n3) {
return isNaN(n1) || isNaN(n2) || isNaN(n3) ? NaN : n1 >= Math.min(n2, n3) && n1 <= Math.max(n2, n3);
};
@hendriklammers
hendriklammers / splitString.js
Last active January 6, 2024 15:46
Javascript: Split String into size based chunks
/**
* Split a string into chunks of the given size
* @param {String} string is the String to split
* @param {Number} size is the size you of the cuts
* @return {Array} an Array with the strings
*/
function splitString (string, size) {
var re = new RegExp('.{1,' + size + '}', 'g');
return string.match(re);
}
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active May 24, 2024 15:47
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@gene1wood
gene1wood / batch-delete-gmail-emails.js
Last active May 20, 2024 00:41
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
/*
This script, when used with Google Apps Scripts, will delete 400 emails and
can be triggered to run every few minutes without user interaction enabling you
to bulk delete email in Gmail without getting the #793 error from Gmail.
Google returns a maximum of 500 email threads in a single API call.
This script fetches 400 threads in case 500 threads is causing timeouts
Configure the search query in the code below to match the type of emails
you want to delete
@cjaoude
cjaoude / gist:fd9910626629b53c4d25
Last active May 15, 2024 16:02
Test list of Valid and Invalid Email addresses
Use: for testing against email regex
ref: http://codefool.tumblr.com/post/15288874550/list-of-valid-and-invalid-email-addresses
List of Valid Email Addresses
email@example.com
firstname.lastname@example.com
email@subdomain.example.com
firstname+lastname@example.com
@zashme
zashme / splitByMonths.php
Created February 6, 2015 16:47
split date range into months ranges
<?php
function getMonthRanges($start, $end)
{
$timeStart = strtotime($start);
$timeEnd = strtotime($end);
$out = [];
$milestones[] = $timeStart;
$timeEndMonth = strtotime('first day of next month midnight', $timeStart);
while ($timeEndMonth < $timeEnd) {
@DraTeots
DraTeots / ComPort over Network.md
Last active June 2, 2024 20:00
ComPort over Network
@jakerella
jakerella / jkq.js
Last active May 3, 2024 01:49
An ultra-light, jQuery-like micro-library for selecting DOM elements and manipulating them.
(function() {
'use strict';
/**
* Core method, similar to jQuery (only simpler)
*
* @param {String|HTMLElement} s The CSS selector to search for or HTML element to wrap with functionality
* @param {HTMLElement} root OPTIONAL An HTML element to start the element query from
* @return {Array} The collection of elements, wrapped with functionality (see API methods)
*/