Skip to content

Instantly share code, notes, and snippets.

View Rakhmanov's full-sized avatar
🥑

Denis Shatilov Rakhmanov

🥑
View GitHub Profile
@Rakhmanov
Rakhmanov / .sh
Created January 17, 2023 16:43
Dynamic IPMI Fan control on Supermicro x11
#!/bin/bash
#list_disk=/dev/ada*
# can be
list_disk="/dev/ada0 /dev/ada1"
highest_temp=000;
for disk in $list_disk; do
{
"data": [
{
"id": "1",
"sessionNumber": "1",
"date": "1/7/2019",
"note": "",
"topic": "Introduction",
"reminders": "Quiz #0 on Prerequisite Math (does not count towards grade)"
},

Keybase proof

I hereby claim:

  • I am rakhmanov on github.
  • I am rakhmanov (https://keybase.io/rakhmanov) on keybase.
  • I have a public key ASCJH9PMmq-zu7TJ1pBGFTFHOOjJsbvNefrZ_h28fwuz_go

To claim this, I am signing this object:

@Rakhmanov
Rakhmanov / .php
Created March 1, 2017 16:18
PHP Memory Consumption script by @nikic
$startMemory = memory_get_usage();
$array = range(1, 100000);
echo memory_get_usage() - $startMemory, " bytes\n";
@Rakhmanov
Rakhmanov / gist:e8019d6ca7adb60d6f70
Created July 14, 2015 22:34
Login\Logout Menu other implimitation. Found on the web, not tested.
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
ob_start();
wp_loginout('index.php');
$loginoutlink = ob_get_contents();
ob_end_clean();
$items .= '<li>'. $loginoutlink .'</li>';
return $items;
}
@Rakhmanov
Rakhmanov / gist:a9672d61aae3a2bb81d0
Created July 14, 2015 22:32
Login\Logout menu link wordpress. Found in web.
add_filter( 'wp_nav_menu_items', 'wti_loginout_menu_link', 10, 2 );
function wti_loginout_menu_link( $items, $args ) {
if ($args->theme_location == 'primary') {
if (is_user_logged_in()) {
$items .= '<li><a href="'. wp_logout_url() .'">Log Out</a></li>';
} else {
$items .= '<li><a href="'. wp_login_url(get_permalink()) .'">Log In</a></li>';
}
}
@Rakhmanov
Rakhmanov / Sub menu navigation
Created July 14, 2015 22:18
Custom Menu Registration, If in category or in descendant.
if ( ! function_exists( 'post_is_in_descendant_category' ) ) {
function post_is_in_descendant_category( $cats, $_post = null ) {
foreach ( (array) $cats as $cat ) {
// get_term_children() accepts integer ID only
$descendants = get_term_children( (int) $cat, 'category' );
if ( $descendants && in_category( $descendants, $_post ) )
return true;
}
return false;
}