Skip to content

Instantly share code, notes, and snippets.

View cdowebcast's full-sized avatar
🏠
Working from home

CDOWEBCAST cdowebcast

🏠
Working from home
View GitHub Profile
@cdowebcast
cdowebcast / curl_progress.php
Created October 28, 2018 04:37 — forked from bdunogier/curl_progress.php
PHP/cURL download progress monitoring
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
@cdowebcast
cdowebcast / index.html
Created January 13, 2019 12:59 — forked from shaan360/index.html
The Spotify logo made with pure CSS
<div class="spotify">
<div class="bar bar-dark"></div>
<div class="bar bar-med"></div>
<div class="bar bar-light"></div>
</div>
@cdowebcast
cdowebcast / 1) Install
Created March 12, 2019 13:20 — forked from nghuuphuoc/1) Install
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
@cdowebcast
cdowebcast / dnsbl.php
Created April 24, 2019 15:29 — forked from tbreuss/dnsbl.php
IP Blacklist Check Script - This is a simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once.
<?php // Simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once. ?>
<html>
<head>
<title>DNSBL Lookup Tool - IP Blacklist Check Script</title>
</head>
<body>
<h2>IP Blacklist Check Script</h2>
<form action="" method="get">
<input type="text" value="" name="ip"/>
<input type="submit" value="LOOKUP"/>
@cdowebcast
cdowebcast / rules-both.iptables
Created April 26, 2019 10:15 — forked from jirutka/rules-both.iptables
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <[email protected]>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@cdowebcast
cdowebcast / fullNameToFirstName.php
Created November 17, 2019 03:11 — forked from stilliard/fullNameToFirstName.php
PHP - Get a users first name from the full name
<?php
/**
* Get a users first name from the full name
* or return the full name if first name cannot be found
* e.g.
* James Smith -> James
* James C. Smith -> James
* Mr James Smith -> James
* Mr Smith -> Mr Smith
// cURL replacement for file_get_contents()
// Safer alternative to enabling allow_url_fopen in php.ini :)
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
@cdowebcast
cdowebcast / flac2mp3
Created September 15, 2020 21:09 — forked from micahjsmith/flac2mp3
convert flac to mp3
#!/usr/bin/env bash
# convert flac to mp3
# source: @Jake Plimack/@boehj https://apple.stackexchange.com/a/293421
# usage:
# find <dir> -name '*flac' -print0 | xargs -0 -P8 -n1 flac2mp3
for f in "$@"; do
[[ "$f" != *.flac ]] && continue
album="$(metaflac --show-tag=album "$f" | sed 's/[^=]*=//')"
@cdowebcast
cdowebcast / index.php
Created December 9, 2020 22:49 — forked from kosso/index.php
Proxy script for Shoutcast audio streams.
<?php
// Proxy script for Shoutcast audio streams.
// Overcomes the CORS issue when using JavaScript to fetch streams for playback and analysis.
// Also http > https
/*
// .htaccess file
// eg: index.php and .htaccess in /radio on your host.
// Point JS/fetch to https://yourhost/radio/audio.mp3 (or any made-up .mp3 name)
@cdowebcast
cdowebcast / .htaccess
Created April 5, 2021 12:21 — forked from jolantis/.htaccess
my .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# Don't allow users to view robots.txt file
# RewriteCond %{REQUEST_URI} !^/robots\.txt$
# Force add 'www' to URIs without 'www' (permanent redirect)
# RewriteCond %{HTTP_HOST} ^yourdomainname\.com$ [NC]
# RewriteRule ^(.*)$ http://www.yourdomainname.com/$1 [L,R=301]