Skip to content

Instantly share code, notes, and snippets.

/* From https://github.com/raspberrypi-ui/rc_gui/blob/master/src/rc_gui.c#L23-L70 */
#define GET_CAN_EXPAND "sudo raspi-config nonint get_can_expand"
#define EXPAND_FS "sudo raspi-config nonint do_expand_rootfs"
#define GET_HOSTNAME "sudo raspi-config nonint get_hostname"
#define SET_HOSTNAME "sudo raspi-config nonint do_hostname %s"
#define GET_BOOT_CLI "sudo raspi-config nonint get_boot_cli"
#define GET_AUTOLOGIN "sudo raspi-config nonint get_autologin"
#define SET_BOOT_CLI "sudo raspi-config nonint do_boot_behaviour B1"
#define SET_BOOT_CLIA "sudo raspi-config nonint do_boot_behaviour B2"
#define SET_BOOT_GUI "sudo raspi-config nonint do_boot_behaviour B3"
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
xdebug.remote_host=192.168.10.254
xdebug.idekey=phpstorm
@frak
frak / python_environment_setup.md
Created January 27, 2019 15:49 — forked from Geoyi/python_environment_setup.md
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. That way you can keep each project in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. This intermediate guide covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda). See the Using the workflow section to view the end result.

Use cases

  1. Working on 2+ projects that each have their own dependencies; e.g., a Python 2.7 project and a Python 3.6 project, or developing a module that needs to work across multiple versions of Python. It's not reasonable to uninstall/reinstall modules every time you want to switch environments.
  2. If you want to execute code on the cloud, you can set up a Python environment that mirrors the relevant
@frak
frak / MigrationHandler.php
Last active October 31, 2019 12:03
Run Doctrine migrations on composer install
<?php
namespace AppBundle\Composer;
use Composer\Script\Event;
use Sensio\Bundle\DistributionBundle\Composer\ScriptHandler;
class MigrationHandler extends ScriptHandler
{
/**
@frak
frak / closure.php
Created September 7, 2016 10:54
Referencing $this in a closure works :S
<?php
class Called
{
public function doThis($callback)
{
$callback('this is not a love song');
}
}
@frak
frak / phpstorm_cleanup.php
Created August 17, 2016 15:17
Removes the comment header blocks on new files
#!/usr/bin/env php
<?php
if ($argc !== 2) {
die('Usage: cleanup_header_comments.php directory_to_fix'.PHP_EOL);
}
$workingDir = $argv[1];
if (is_dir($workingDir) === false || is_writable($workingDir) === false) {
die($workingDir.' either does not exist or is not writable');

Keybase proof

I hereby claim:

  • I am frak on github.
  • I am frak (https://keybase.io/frak) on keybase.
  • I have a public key ASBZKTAz8fEvT9vmDNv1tUDCm-2ndGfcVk0SKGTjmSFsdwo

To claim this, I am signing this object:

@frak
frak / apiSpec.js
Last active November 25, 2015 15:14
'use strict';
var dbSession = require('./dbSession.js');
var Percolator = require('percolator').Percolator;
var Server = function (port) {
var server = Percolator({'port': port, 'autoLink': false, 'staticDir': __dirname + '/../frontend'});
server.route(
'/api/keywords',
@frak
frak / deploy.rb
Created September 25, 2015 18:47
Task to add 'parameters:' to an empty parameters file
#task to add 'parameters:' to an empty parameters file
task :fix_empty_parameters_yml
do
parameters_path = "app/config/parameters.yml"
run "LEN=$(cat #{shared_path}/#{parameters_path} | wc -c); if [ $LEN -eq 0 ] ; then echo \"parameters:\" > #{shared_path}/#{parameters_path} ; fi"
end
#run the parameters fix task before composer kicks off
before "symfony:composer:install", "fix_empty_parameters_yml"
@frak
frak / xdebug.ini
Created March 3, 2015 22:15
xdebug conf
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.show_exception_trace=0
xdebug.show_local_vars=0
xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20
xdebug.profiler_output_dir=/tmp
xdebug.idekey=PHPSTORM