Skip to content

Instantly share code, notes, and snippets.

View ChriRas's full-sized avatar

Christoph Raschke ChriRas

View GitHub Profile
@ChriRas
ChriRas / readme.md
Last active June 25, 2024 15:26
Set up default audio device on Ubuntu 20.04 LTS

Problem

I have a notebook connected to a port replicator. I want to use the build-in speakers and microfone and not the external ones. If I boot my notebook in my port replicator Ubuntu changes the devices to external.

Solution

  1. Find your internal speaker
pactl list short sinks
@ChriRas
ChriRas / bash
Created April 20, 2020 08:49
Use PHP version you want on a plesk server
echo "alias php73='/opt/plesk/php/7.3/bin/php'" >> ~/.bashrc
@ChriRas
ChriRas / transformCode.md
Last active June 21, 2019 12:55
Regex to tranform Code in PHPstom using search&replace

Change a 'define' into a 'const'

From define('WT_TYPE', 2); to public const WT_TYPE = 2;

search: define\('([\w]*)', ([\w]*)\); replace: public const $1 = $2;

Change a get an array field into a function call

From this 'return $this->attributes['example'];' to 'return $this->getAttribute('example');'

@ChriRas
ChriRas / split_string_using_cutom_delimiter.snippets
Last active January 28, 2016 12:02
SPLIT STRING USING CUSTOM DELIMITER This example uses colon (:)
/"[^"]*"|[^\:]+/g
@ChriRas
ChriRas / debug.php
Last active August 29, 2015 14:16
Simple PHP Debug with var_dumb, print_r and print_r to js-Console
<?php
print __FILE__ . " " . __LINE__." ";
var_dump($variable);
die;
?>
@ChriRas
ChriRas / document_ready.js
Created February 10, 2015 09:33
init jquery document ready
$( document ).ready(function() {
console.log( "ready!" );
});
@ChriRas
ChriRas / canonicalRedirect.htaccess
Created November 17, 2014 10:46
Apache htaccess/virtualhost rule to redirect 301 non-www version to www-version (to avoid duplicate URLs on search engines) e.g. example.org/one/two -> www.example.org/one/two
# .htaccess or Apache vhost
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
@ChriRas
ChriRas / copy_dir.sh
Created November 7, 2014 14:10
Kopieren von Ordnern und Unterordnern auf der Linux-Shell
cp -r /home/hope/files/* /home/hope/backup
@ChriRas
ChriRas / tarpacken.sh
Created November 7, 2014 13:55
Tar packen und entpacken
Ein tar.gz-Archiv erstellen:
tar cfvz test.tar.gz
Die Datei test.tar.gz (mit gzip komprimiert) entpacken
tar xfvz test.tar.gz
@ChriRas
ChriRas / joomla_admin.sql
Created November 7, 2014 13:39
Erzeuge einen Superadmin in Joomla 2.5 Passwort ist 1234
INSERT INTO `jos_users` (`id`, `name`, `username`, `email`, `password`, `usertype`, `block`, `sendEmail`, `registerDate`, `lastvisitDate`, `activation`, `params`) VALUES
(42, 'Super User', 'username', 'email@dot.com', '81dc9bdb52d04dc20036dbd8313ed055', 'deprecated', 0, 1, '2011-01-13 12:09:00', '2011-01-14 08:43:24', '', '');
INSERT INTO `jos_user_usergroup_map` (`user_id`, `group_id`) VALUES
(42, 8);