Skip to content

Instantly share code, notes, and snippets.

@dmiro
dmiro / createdbradio.py
Last active August 25, 2023 11:43
Create sqlite database from repository radio-browser.info
import subprocess
import gzip
import os
"""
create sqlite database from repository radio-browser.info
prerequisites:
(1) install sqlite3 (client)
@thaihust
thaihust / dos2unix.md
Created November 2, 2017 01:19 — forked from umidjons/dos2unix.md
Execute dos2unix for directory recursively.

Will recursively find all files inside current directory and call for these files dos2unix command. Would break if you had spaces in file name.

find . -type f -exec dos2unix {} \;

Wouldn't break if you had spaces in file names.

find . -type f -print0 | xargs -0 dos2unix
@bisubus
bisubus / ES5-ES6-ES2017-ES2019 omit & pick
Last active April 13, 2024 21:03
ES5/ES6/ES2017/ES2019 omit & pick
@mehdichaouch
mehdichaouch / memory_usage.php
Last active October 14, 2024 10:53
PHP Snippet to get human readable memory usage
<?php
function convert($size)
{
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}
convert(memory_get_usage());
@martinbean
martinbean / pre-commit
Last active December 19, 2023 22:14
Pre-commit hook to detect if any .php files contain dd()
#!/usr/bin/php
<?php
$files = shell_exec('git diff-index --name-only --cached --diff-filter=ACMR HEAD | grep "\.php$"');
$files = explode("\n", trim($files));
$exitCode = 0;
foreach ($files as $file) {
if (empty($file)) {
@jqtrde
jqtrde / modern-geospatial-python.md
Last active August 1, 2023 14:50
Modern remote sensing image processing with Python
@loicknuchel
loicknuchel / angularPlugin.js
Created January 21, 2015 10:20
Angular MediaSrv : play audio with Cordova & Ionic apps
angular.module('my.cordova.plugins', ['ionic'])
// for media plugin : http://plugins.cordova.io/#/package/org.apache.cordova.media
.factory('MediaSrv', function($q, $ionicPlatform, $window){
var service = {
loadMedia: loadMedia,
getStatusMessage: getStatusMessage,
getErrorMessage: getErrorMessage
};
@vool
vool / debian_setup.md
Last active June 19, 2020 15:24
Debain standard setup

Debain setup

Default set up for git deploy web-server on debian box [for a laravel site but also pretty generic]

There a good guide (for ubuntu) here

Update and install

apt-get update &amp;&amp; apt-get upgrade

@clouddueling
clouddueling / upload.js
Created March 3, 2013 07:34
resumable.js example
var uploader = (function(){
var r = Resumable({
target: '/upload/stream',
chunkSize: 1*1024*1024,
query: {
serie_id: {{ $serie->id }}
}
}),
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/