Skip to content

Instantly share code, notes, and snippets.

View hawkeyetwolf's full-sized avatar

Hawkeye Tenderwolf hawkeyetwolf

View GitHub Profile
@hawkeyetwolf
hawkeyetwolf / script.sh
Created August 19, 2018 22:30
Create .nvmrc automagically
nvm install stable | grep -ohe 'v[0-9]*\.[0-9]*\.[0-9]*' | head -1 > .nvmrc && nvm use
@hawkeyetwolf
hawkeyetwolf / -dotfiles
Last active July 17, 2021 17:11
dotfiles + other config
.
@hawkeyetwolf
hawkeyetwolf / slack-skinny-sidebar.css
Created March 15, 2018 06:34
Slack skinny sidebar
.client_channels_list_container, #col_channels, .p-channel_sidebar__list {
max-width: 179px;
}
@hawkeyetwolf
hawkeyetwolf / keybase.md
Last active August 10, 2018 19:24
keybase.md

Keybase proof

I hereby claim:

  • I am hawkeyetwolf on github.
  • I am tenderwolf (https://keybase.io/tenderwolf) on keybase.
  • I have a public key ASAMt2n7czjehq8np12YvN3XgfbOIW2fjPoZioKUVryWqAo

To claim this, I am signing this object:

@hawkeyetwolf
hawkeyetwolf / twigshim-json-example.php
Last active March 18, 2017 00:34
Twigshim example: Using json mock data to populate a component
/**
* Overrides the theme function for the "Example" Paragraphs bundle.
*/
function mytheme_paragraphs_item__example(&$vars) {
$component = 'molecules/example/example';
$file = kalastatic_path_to_kalastatic() . "/src/components/$component.json";
$json = file_get_contents($file);
$twig_template_vars = drupal_json_decode($json);
return twigshim_render("$component.html.twig", $twig_template_vars);
}
@hawkeyetwolf
hawkeyetwolf / gist:073ffbd5bdc60018099c738b8ec9e880
Last active November 18, 2016 02:24
Upload SSH public key to authorized_keys
# Thanks to Chris Hales for giving me this little snippet back in the day.
# Replace "__SERVER__" with "user@hostname".
cat ~/.ssh/id_rsa.pub | ssh __SERVER__ 'cat >> ~/.ssh/authorized_keys'
# Make sure permissions are correctly set on the file and its parent directory.
ssh __SERVER__ 'chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys'
@hawkeyetwolf
hawkeyetwolf / USAGE.md
Created April 12, 2016 15:21
Securing file permissions and ownership in Drupal

Securing file permissions and ownership in Drupal

@see https://www.drupal.org/node/244924

Copy the code above to a file, name it fix-permissions.sh and run it as follows:

sudo bash fix-permissions.sh --drupal_path=your/drupal/path --drupal_user=your_user_name

Note: The server group name is assumed www-data, if it differs use the --httpd_group=GROUP argument.

.
@hawkeyetwolf
hawkeyetwolf / install-pre-commit-hook.php
Created December 22, 2015 16:26
Install useful git pre-commit hooks
<?php
echo "Creating hooks directory.\n";
mkdir('.git/hooks', 0775, true);
echo "Downloading pre-commit hook.\n";
$fp = fopen('.git/hooks/pre-commit', 'w');
$precommit = file_get_contents('http://gitscripts.s3.amazonaws.com/pre-commit');
fwrite($fp, $precommit);
fclose($fp);
@hawkeyetwolf
hawkeyetwolf / fix-permissions.sh
Created December 22, 2015 16:24
Restore secure file and directory permissions to Drupal site
#!/bin/bash
if [ $(id -u) != 0 ]; then
printf "This script must be run as root.\n"
exit 1
fi
drupal_path=${1%/}
drupal_user=${2}
httpd_group="${3:-www-data}"
# Help menu