Skip to content

Instantly share code, notes, and snippets.

@keyndark
keyndark / howto-forward-x11-to-win10-via-putty-vcxsrv.md
Last active October 17, 2018 19:13 — forked from vietlq/howto-forward-x11-to-win10-via-putty-vcxsrv.md
Code2Pro: How to Forward X11 to Windows 10 via PuTTY & vcxsrv

Code2Pro: How to Forward X11 to Windows 10 via PuTTY & vcxsrv

Scope

Tested on Windows 10 & Ubuntu 16.

Steps

  1. Check that sshd on Ubuntu is properly configured
@keyndark
keyndark / regex_from_array_to_object_accessing.txt
Created May 24, 2017 09:16
PHPStorm Regex Convert Array to Object Syntax
PHPStorm Regex Convert Array to Object Syntax
If you are converting some code from using array syntax to object property syntax then you might like this little snippet of regex.
This is design to paste straight into the find/replace dialogue in PHPStorm
Find:
\$(\w+)\['([^']+)'\]
Replace:
@keyndark
keyndark / regex_from_object_to_array_accessing.txt
Created May 24, 2017 08:23 — forked from application2000/regex_from_object_to_array_accessing.txt
PhpStorm regex to replace PHP object-like accessing to PHP array-like accessing
Do you keep modifiying $my_variable->foo to $my_variable['foo'] over and over everyday? This regex is for you.
text to replace : (\$some_variable)(\->)([\w]+)
replacement : $1\[\'$3\'\]
Backup your files to prevent any problems. Use this with caution. At your own risk.
Usage:
1. Keyboard shortcut Cmd + R or equivalent to trigger a text replace
2. Click on the regex checkbox
<html>
<head>
<title>Checkbox</title>
<style>
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label
{
@keyndark
keyndark / dump.sh
Created October 22, 2016 19:48 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@keyndark
keyndark / nginx.conf
Created February 17, 2016 17:08 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@keyndark
keyndark / gist:4bd85d6e7d8e41c99d4e
Created October 16, 2015 11:57
Debug WordPress 404 issues (permalinks, rewrite rules, etc.)
/* Produces a dump on the state of WordPress when a not found error occurs */
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<pre>';
add_action( 'parse_request', 'debug_404_rewrite_dump' );
function debug_404_rewrite_dump( &$wp ) {
// simple jquery tinymce lazyload
// - using $.getScript alone will not work
// - it's important to set the tinymce basepath, and set the domLoaded attribute
window.tinyMCEPreInit = {
base: '/js/tiny_mce/',
suffix : '',
query : ''
};
$(function(){

Setting up RhodeCode on Ubuntu Server 12.04

Goal

  • Everything running on a single Ubuntu Server
  • RhodeCode running in a virtualenv
  • Use SQLite as the database
{
"491289025" : "ijinshan-kappmarket://",
"301521403" : "fb103361823069955://",
"492178411" : "ils492178411://",
"346142396" : "fb234434003713://",
"310633997" : "whatsapp://",
"370614765" : "com.condenet.newyorker://",
"325058491" : "rnmddisco://",
"382952264" : "epichttp://",
"477048487" : "predictwind://",