Skip to content

Instantly share code, notes, and snippets.

Dainius dainiuxt

Block or report user

Report or block dainiuxt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:f6680dd662548f4f15ddee85cd9e70b7
sudo smartctl --all /dev/sda
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.10.0-28-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Toshiba 2.5" HDD MK..76GSX
Device Model: TOSHIBA MK6476GSX
Serial Number: 22DDPAMST
LU WWN Device Id: 5 000039 3d2786cc0
Firmware Version: GS001C
@dainiuxt
dainiuxt / wpSQL.md
Last active Dec 8, 2017
How to Work with the WordPress Database: 11+ Useful SQL Queries
View wpSQL.md

https://www.wpkube.com/work-wordpress-database-11-useful-sql-queries/

  1. Change Your WordPress Password

Forgotten your password and locked yourself out of your WordPress site? No worries – you can reset it manually in the database with this SQL query:

UPDATE wp_users SET user_pass = MD5( '[new_password]' ) WHERE user_login = '[username]';

MD5 encrypts the new password so anyone gaining access to the database is not able to read the password.

@dainiuxt
dainiuxt / functions.php
Created Mar 24, 2017
Add custom code before post content via functions.php
View functions.php
<?php
function my_before($content) {
if (is_single()) {
$beforecontent = previous_post_link(); ?> | <?php next_post_link();
$content = $beforecontent . $content;
return $content;
}
return $content;
}
add_filter('the_content', 'my_before');
@dainiuxt
dainiuxt / style.css
Created Mar 23, 2017
Divi portfolio grid view image resize. Just change the padding-top until you get the desired aspect ratio.
View style.css
.et_portfolio_image {
padding-top: 100%;
}
.et_portfolio_image img {
position: absolute;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
@dainiuxt
dainiuxt / index.html
Created Mar 22, 2017
The object-fit property defines how an element responds to the height and width of its content box. It's intended for images, videos and other embeddable media formats in conjunction with the object-position property. Used by itself, object-fit lets us crop an inline image by giving us fine-grained control over how it squishes and stretches insi…
View index.html
<div class="original-image">
<p>original image</p>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/14179/image.png">
</div>
<div class="image">
<p>object-fit: fill</p>
<img class="object-fit_fill" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/14179/image.png">
</div>
@dainiuxt
dainiuxt / divi_contactform_submit_button.js
Last active Mar 22, 2017
Submit Button Text in contact module can be changed by applying some JavaScript, just follow given steps to achieve the goal. Go to Divi > Theme Option > Integration Paste the given code in Head section
View divi_contactform_submit_button.js
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("button.et_pb_contact_submit").text('<strong>This is it</strong>');
});
</script>
@dainiuxt
dainiuxt / gist:731ffebc9672a600022a
Last active Mar 24, 2017
Install packages in R on demand (if require)
View gist:731ffebc9672a600022a
if (!require("data.table")) {
install.packages("data.table")
}
if (!require("reshape2")) {
install.packages("reshape2")
}
require("data.table")
require("reshape2")
View R trouble.r
Problem solved. Faulty code in line 16: geom_line(aes(y = monthly$CumOil, colour = "CumOil, 1000 m3"))
R version 3.1.0 (2014-04-10) -- "Spring Dance"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)
Code:
library("ggplot2")
ggplot(monthly[monthly$Well_N == "NSD1",],aes(Date_m)) +
@dainiuxt
dainiuxt / MSAccessDBConnection.r
Last active Mar 24, 2017
Connect MS Access database to R (RStudio) in Windows
View MSAccessDBConnection.r
library("RODBC") #load package
db<-file.path("C:/path/to/your/database.accdb") #connect database.
#Note the UNIX style slash (/). "\" is "escape character" so all "\"you should replace either with "/" or "\\"
channel<-odbcConnectAccess2007(db) #internal RODBC function
dataSetName<-sqlFetch(channel,"TableName") #read particular table from Access database file.
You can’t perform that action at this time.