Skip to content

Instantly share code, notes, and snippets.

View necmettin's full-sized avatar

Necmettin Begiter necmettin

View GitHub Profile
@necmettin
necmettin / find-0000
Created January 26, 2023 02:12
Find date and datetime fields with invalid values
<?php
function cmd_db_find_0000(): void
{
global $App;
$key = "Tables_in_bulundum_com";
$tables = field2array($App->RDB->run("SHOW TABLES"), $key);
foreach ($tables as $tablename)
{
$fields = $App->RDB->run("SHOW COLUMNS FROM `$tablename`");
#/usr/bin/env python3
import sys
if len(sys.argv) < 4:
print("Dosya adi, bastan kesilecek satir sayisi ve sondan kesilecek satir sayisi ver")
if len(sys.argv) < 2:
sys.exit()
@necmettin
necmettin / download-cloudinary-files.php
Created October 1, 2022 09:20
Downloads cloudinary files, 300 at a time
<?php
use Cloudinary\Configuration\Configuration;
use Cloudinary\Api\Admin\AdminApi;
function download_cloudinary_files(string $cloud_name, string $api_key, string $api_secret): void {
global $App;
$instance = Configuration::instance(['cloud'=>[
'cloud_name'=>$cloud_name,
@necmettin
necmettin / random-string.js
Created August 19, 2015 19:19
Generate 8 random letters in JavaScript
Math.random().toString(36).slice(2, 10)
@necmettin
necmettin / javascript-get-image-as-data-string.js
Created August 18, 2015 13:08
Javascript Get-Image as Data String
function getDataUri(url, callback) {
var image = new Image();
image.onload = function () {
var canvas = document.createElement('canvas');
canvas.width = this.naturalWidth; // or 'width' if you want a special/scaled size
canvas.height = this.naturalHeight; // or 'height' if you want a special/scaled size
canvas.getContext('2d').drawImage(this, 0, 0);
@necmettin
necmettin / find-multiple-extensions.sh
Created August 14, 2015 18:48
Find files by extension, multiple extensions
find FOLDER -type f \( -iname \*.php -o -iname \*.twig \)
@necmettin
necmettin / download-ftp-folder-wget.sh
Created August 14, 2015 18:42
Download FTP folder using wget
wget -m ftp://username:password@server/path -A LISTOFFILENAMEEXTENSIONS -P TARGETFOLDER --limit-rate=200k -nv -o wget.log
@necmettin
necmettin / stack-trace.js
Last active August 29, 2015 14:27
Artificial Stack Trace
console.log(new Error().stack);