Skip to content

Instantly share code, notes, and snippets.

View begroff's full-sized avatar

Brett Groff begroff

View GitHub Profile
@Kaapiii
Kaapiii / fix-vgacon-disable-amdgpu.md
Created April 16, 2020 13:58
Ubuntu 19.10 and Ubuntu 20.04 (beta) - "Unknown display" / Unable to detect multiple displays with Radeon rx570 gpu

Ubuntu is not able to detect multipble displays when using an gpu from AMD. Error "VGACON disables amdgpu ..."

When searching for graphics card with "sudo lshw -c video" on Ubuntu 19.10 or 20.04 (beta) the following error is shown:

# list graphics/video cards
sudo lshw -c video
#[drm:amdgpu_init [amdgpu]] *ERROR* VGACON disables amdgpu kernel mode setting.
@Kmaschta
Kmaschta / generate-self-signed-certificate-with-custom-CA.md
Created January 9, 2019 14:43
How to generate a self-signed that is valid for your browser (by creating your custom certificate authority)

If you're using self-signed certificate for your web server on development, you might know the browser warning saying that your certificate isn't valid. If like me you had manually added an exception for this certificate error each time it showed up, this gist is for you.

Properly Configure OpenSSL with your DNS aliases

You'll have to create a self-signed certificate with a custom SubjectAltName.

  1. Find your openssl config. find /usr/lib -name openssl.cnf
/**
* Settings
*/
var settings = {
scripts: true, // Turn on/off script tasks
polyfills: true, // Turn on/off polyfill tasks
styles: false, // Turn on/off style tasks
svgs: false, // Turn on/off SVG tasks
static: false, // Turn on/off static file copying
@msveden
msveden / test-post-receive-without-push.md
Last active April 13, 2018 12:22
Testing post-receive hook without pushing changes

Find the last two commits by:

git log -2 --format=oneline --reverse

Then run the hook by:

echo "[from-commit-id] [to-commit-id] master" | ./hooks/post-receive

@cjkoepke
cjkoepke / logging_errors.js
Created August 10, 2017 18:20
Debugging tips and tricks.
// Great for getting values, outputting context strings, and so on.
console.log(variable)
// Same as console.log(), but prints in yellow as a warning. Useful to show a non-breaking error in a dev env.
console.warn('It is a good idea to use .map instead of a for-loop.')
// Same as console.log(), but prints in red as an error. Useful to show a breaking error in a dev env.
console.error(`The value must be an integer. You provided a ${typeof variable}.`)
// Group console data together for better viewing. Nice to group console logs together.
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
@zuhairkareem
zuhairkareem / search_partial_string_array.php
Last active May 8, 2024 09:54
Search partial string in an array in PHP
<?php
/**
* First Method.
*/
function array_search_partial($arr, $keyword) {
foreach($arr as $index => $string) {
if (strpos($string, $keyword) !== FALSE)
return $index;
}
}
@mattclements
mattclements / function.php
Last active June 16, 2024 10:32
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@vladikoff
vladikoff / doskey.md
Last active March 11, 2024 17:27
Setup Persistent Aliases & Macros in Windows Command Prompt (cmd.exe) using DOSKey

Setup Persistent Aliases & Macros in Windows Command Prompt (cmd.exe) using DOSKey

Saved from Archive.org, Date: May 14, 2010 Author: Jesse Webb

http://web.archive.org/web/20140330024520/http://devblog.point2.com/2010/05/14/setup-persistent-aliases-macros-in-windows-command-prompt-cmd-exe-using-doskey/

Our development machines here at Point2 are not standardized; we have a mixture of Windows XP, 7, and Mac OSX/Unix computers. I find myself constantly switching back and forth between command prompt interfaces when pair programming. As a result, I catch myself using “ls” to list a directories contents regardless of what system I am on. I am currently using a Windows XP machine for my developer box and I wanted to setup an alias to the “ls” command to actually perform a “dir”. Here is how I accomplished it…

There is a command available in a Window’s shell that let’s you “alias” command to whatever you please: DOSKey. It allows you to create “macros” to execute one or more other commands with a custom nam

@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version