Skip to content

Instantly share code, notes, and snippets.

View rolandinsh's full-sized avatar
🧔
Remote developer (LEMP, Node.js, Neo4j [graph])

Rolands rolandinsh

🧔
Remote developer (LEMP, Node.js, Neo4j [graph])
View GitHub Profile
@rolandinsh
rolandinsh / PHP-CURL-Tor-Tutorial.md
Last active August 11, 2023 18:44 — forked from megaxorg/PHP-CURL-Tor-Tutorial.md
PHP: CURL Requests with Tor

#CURL Connections with Tor

Install Apache, PHP, CURL & Tor with apt-get

sudo apt-get install -y apache2 php php-curl tor

Tor creates a proxy on your mashine with port 9050 for SOCKS5 connections.

@rolandinsh
rolandinsh / gist:5644457
Created May 24, 2013 15:50
Yoast anonymous tracking
<?php
/**
* @package Admin
*/
if ( !defined( 'GAWP_VERSION' ) ) {
header( 'HTTP/1.0 403 Forbidden' );
die;
}
@rolandinsh
rolandinsh / gist:3259141
Created August 4, 2012 18:18
Bitbucket create/init and add remote
$ mkdir /path/to/your/project
$ cd /path/to/your/project
$ git init
$ git remote add origin https://USERNAME@bitbucket.org/USERNAME/project.git
Create a new repository on the command line
touch README.md
git init
@rolandinsh
rolandinsh / isASIN.php
Created October 9, 2022 14:49
Check if is Amazon ASIN like code
<?php
function isAsin($string){
$asinpattern = "/B[0-9]{2}[0-9A-Z]{7}|[0-9]{9}(X|0-9])/";
return preg_match($asinpattern, $string, $matches) === 1;
}
@rolandinsh
rolandinsh / gist:5143047
Last active September 8, 2022 15:19
Codeigniter file upload permissions (CHMOD)
<?php
$config['upload_path'] = './uploads/'; // upload path
/* OR any other form, e.g.:
$config['upload_path'] = $_SERVER["DOCUMENT_ROOT"].'/uploads/'; // upload path
$config['upload_path'] = __DIR__.'/uploads/'; // upload path
*/
$config['allowed_types'] = 'zip'; // array or string of file extensions
$config['max_size'] = '100'; // max file size
$this->load->library('upload', $config); // do the job
$zdata = ['upload_data' => $this->upload->data()]; // get data
@rolandinsh
rolandinsh / gist:3097506
Created July 12, 2012 11:14
WordPress remove_action wp_head
/*
via wordpress.org/support/topic/remove-feed-from-wp_head?replies=7#post-1338292
for: http://simplemediacode.com/wordpress/
*/
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link
@rolandinsh
rolandinsh / ASCII-rolands.txt
Last active April 27, 2022 18:59
ASCII Rolands
,,.,..,.,..,.,,,,,,,.,,,.,,.,,,,..,,,,.,,,,,,.,,.,*&@@@@@@@@@(,,(@@@@&(*,,,,,,,,
@@@@@@@@@@@@@@@@&&&@&@@@@@@@&%@@@@@@%(&@@(,.,,,,,,,.,(&&&&&&@@@@@@@@@@@@@@@@@@&(
&&&&&&&&&&&&&&&&&&@&(..,,@*,,@@(,,@,*,%@@@@&*,/@@@@@@@@%,((&@@@@&*,,,,,,**/*///*
&&&&&&&&&&&&&&@@,*.&&/(,%%#@&,(,.#@*../%@@&@@@@@@&@@@@@@@@/,,*,*,***************
&&&&&&&&&&&&@*.#,,.%@/,@@@,(&@@@@@&#/@@@@*/@@@@@@@@@@@@@@@@@/***,***************
@@@@@@@@@@#.*@/,&@@@,@@(@&@@,*&@@@@@@@@#(&@@@@@@@@@@@@@@@&(@@**,****************
,,***,,,,*,/%,@@(@@@@@@@@%@@@@@@@@@@@@@@@@@@@@@@@@@&(@(#,,*/,&,,,***************
***,,,**,,@,@@*@&@@@@@@@@@@@@@@@@@@&,,,,,,..,,,,(*/(((/((((((/(,,,**************
,******,,@,@@@@@@@@@@@@@@@@##&*&@&@#,*/****,,****//((((((((((((,@,,*************
,/%((*,,@,%@@@@@@@@@#@%,,*((*(((,&&%@,,************/(((((((((((/,@,,,**//*//////
@rolandinsh
rolandinsh / namedays-extended.json
Last active March 25, 2022 16:39 — forked from laacz/namedays-extended.json
Vārdadienas JSON (par prieku Sergejam)
{
"01-01": ["Afra", "Afrodīte", "Agunda", "Agurs", "Januārija", "Laimstars", "Soleda", "Solita", "Solveta"],
"01-02": ["Induls", "Īva", "Ivaise", "Ivija", "Īvija", "Ivika", "Īvis", "Ivisa", "Ivs"],
"01-03": ["Ambrozijs", "Ammonārija", "Ammunārija", "Mežvaldis", "Mieriņš", "Miermīlis", "Miernesis", "Miervalds", "Ringla", "Ringo", "Rinolds"],
"01-04": ["Amina", "Amīna", "Amirans", "Amirs", "Blāzma", "Ilveta", "Ilvis", "Spodrīte"],
"01-05": ["Amrita", "Amunds", "Anarita", "Saimona", "Saimons", "Seimanis", "Semions", "Semjons", "Simeons", "Simions", "Zintauts", "Zinturs"],
"01-06": ["Arams", "Aranta", "Arfa", "Arnīda", "Arnija", "Arnika"],
"01-07": ["Julians", "Jūlians", "Jūliāns", "Sigmars", "Sigmārs", "Zigmāra", "Zigmāris", "Zigmars"],
"01-08": ["Ants", "Aristarhs", "Aristida", "Aristīda", "Aristids", "Aristīds", "Aristons", "Aristrīds", "Arjana", "Arlands", "Arleta", "Arlēna", "Arlijs", "Arlita", "Gatiņš", "Īvande", "Ivanna", "Ivase", "Ivena"],
"01-09": ["Aksela", "Akselis",
@rolandinsh
rolandinsh / gist:5636349
Last active February 22, 2022 14:56
wp_new_user_notification() - wordpress new user notification message on register
<?php
if ( !function_exists( 'wp_new_user_notification' ) ) {
function wp_new_user_notification( $studentID, $plaintext_pass = '' ) {
$student = new WP_User($studentID);
$student_data = get_userdata( $studentID );
$firstname = $student_data->first_name;
$student_login = stripslashes( $student_data->user_login );
// URLs
$site_url = site_url();
@rolandinsh
rolandinsh / gist:3259435
Created August 4, 2012 19:14
calculate date from day of year in php
<?php $todayid = date("z"); // to get today's day of year
function dayofyear2date( $tDay, $tFormat = 'd-m-Y' ) {
$day = intval( $tDay );
$day = ( $day == 0 ) ? $day : $day - 1;
$offset = intval( intval( $tDay ) * 86400 );
$str = date( $tFormat, strtotime( 'Jan 1, ' . date( 'Y' ) ) + $offset );
return( $str );
}