Skip to content

Instantly share code, notes, and snippets.

View stnc's full-sized avatar
🎯
Focusing

TUNÇ Selman stnc

🎯
Focusing
View GitHub Profile
@stnc
stnc / sort-photos-by-month.py
Created September 30, 2024 04:56 — forked from pkkid/sort-photos-by-month.py
Sort Photos by Month
#!/usr/bin/python3
"""
Sort Photos by Month.
install python3-pil
"""
import logging, datetime
import argparse, os, sys
import hashlib
from PIL import Image
@stnc
stnc / depent.php
Created August 12, 2024 02:17
On a single post page, it gives the categories to which the page is affiliated.
<?php
// $terms = wp_get_post_terms( get_the_id(), 'topics', array( 'orderby' => 'term_order' ));
$terms = wp_get_post_terms( get_the_id(), 'category', array( 'orderby' => 'term_order' ));
echo "<pre>";
print_r( $terms);
get_permalink($id);
@stnc
stnc / cat.php
Last active August 12, 2024 02:14
Get all categories and posts in those categories
<?php
//https://wordpress.stackexchange.com/questions/43426/get-all-categories-and-posts-in-those-categories
$args = array(
'posts_per_page' => -1
);
$query = new WP_Query($args);
@stnc
stnc / example1.php
Last active August 8, 2024 19:41
How to get all registered menus in wordress #menu #WordPress
<?php $menus = get_registered_nav_menus();
foreach ( $menus as $location => $description ) {
echo $location . ': ' . $description . '<br />';
}
@stnc
stnc / adb.css
Created July 22, 2024 19:20
wordpress uploader trigger
span.delete,
span.delete,
span.delete_media {
position: absolute;
top: 0;
right: 0;
display: none;
cursor: pointer;
z-index: 1;
color: #555555;
@stnc
stnc / 1good.html
Last active June 10, 2024 07:46
Knockout example
<!doctype html>
<html class="no-js" lang="en-US">
<head>
<script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/knockout/knockout-3.5.0.js"></script>
<!-- <script src="model.js" type="text/javascript"></script>
-->
<script>
@stnc
stnc / nginxproxy.md
Created September 19, 2023 03:35 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@stnc
stnc / 01index.php
Last active August 19, 2023 03:34
PHP capture print/require output in variable
<?php
function renderHtml($name) {
$path = $name;
if (file_exists($path) == false) {
throw new Exception('View not found in '. $path);
return false;
}
@stnc
stnc / .gitignore
Created August 6, 2023 08:17 — forked from jodosha/.gitignore
How To Test Go HTTPS services
/*.pem
@stnc
stnc / rsasign.go
Created July 16, 2023 04:27 — forked from hansstimer/rsasign.go
Go: rsa signpkcs1v15 signing
package main
import (
"bytes"
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"fmt"
)