Skip to content

Instantly share code, notes, and snippets.

View jonathanstegall's full-sized avatar

Jonathan Stegall jonathanstegall

View GitHub Profile
@jonathanstegall
jonathanstegall / mysql_shell_gzip_dump.bash
Created May 13, 2015 17:18
MySQL Shell: dump item and gzip it
nohup nice mysqldump -uusername -ppassword databasename tablename | gzip -9 > tablename.sql.gz
scp username@servername:/path/to/remote/file.ext /path/to/local/file.ext
@jonathanstegall
jonathanstegall / sql-from-excel.sql
Last active August 29, 2015 14:21
Create SQL command from Excel row values
="Insert into `table` (column1,column2,column3) values('" & A1 & "','"& B1 & "','" & C1 & "','" & D1 & "','" & E1 & "');"
@jonathanstegall
jonathanstegall / drupal_count_users_groupedbyday.sql
Created June 24, 2015 20:40
Count users created in a time period; grouped by day
SELECT count(*) as count, DAY(FROM_UNIXTIME(created)) as day
FROM users
WHERE created >= UNIX_TIMESTAMP('2015-06-22 00:00:00')
GROUP BY day;
@jonathanstegall
jonathanstegall / import-sql.sql
Created July 14, 2015 17:27
Import SQL file into database
use DATABASE_NAME;
source path/to/file.sql;
@jonathanstegall
jonathanstegall / kellum-method-hide-text.css
Last active August 29, 2015 14:27
Hiding text with the Kellum method - named so by Zeldman
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@jonathanstegall
jonathanstegall / Long-running SSH tasks
Created March 3, 2016 22:18
Keep the task running after disconnecting from SSH; also see its status upon returning.
ssh [email protected]
screen #start a screen session
run-a-long-process
CTRL+a , d to detatch from your screen session
exit #disconnect from the server, while run-a-long-process continues
When you come back to your laptop:
@jonathanstegall
jonathanstegall / www-post-thumb.php
Last active March 30, 2018 13:57 — forked from gmazzap/www-post-thumb.php
WordPress plugin that allow to use an external image url as featured image.
<?php namespace GM\WWWPostThumbnail;
/**
* Plugin Name: WWW Post Thumbnail
* Description: Allow to use an external image url as featured image.
* Plugin URI: https://gist.github.com/Giuseppe-Mazzapica/928bc22e5f49a654cf7c
* Author: Giuseppe Mazzapica
* Author URI: https://github.com/Giuseppe-Mazzapica
* License: MIT
* Version: 0.1.1
* Modified by Jonathan Stegall

Keybase proof

I hereby claim:

  • I am jonathanstegall on github.
  • I am jonathanstegall (https://keybase.io/jonathanstegall) on keybase.
  • I have a public key whose fingerprint is F8B8 8A81 ABEB ADAF DEAC B6E8 3550 F7E1 B00D D33A

To claim this, I am signing this object:

@jonathanstegall
jonathanstegall / drupal_count_comments_by_month.sql
Created July 19, 2016 13:21
show how many comments are submitted by month/year
SELECT MONTH(FROM_UNIXTIME(timestamp)) as month, YEAR(FROM_UNIXTIME(timestamp)) as year, count(cid) as comment_count
FROM comments
WHERE timestamp >= UNIX_TIMESTAMP('2014-07-15 00:00:00')
GROUP BY year, month;