Skip to content

Instantly share code, notes, and snippets.

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

corbpie cp6

🏠
Working from home
View GitHub Profile
@cp6
cp6 / MYSQL_backup_compress.bat
Last active November 13, 2017 03:34
Backup MYSQL and compress with a batch file
@echo off
color 0E
title MySQL backup.
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" & set "MS=%dt:~15,3%"
set "dirname=%DD%_%MM%_%YY%_%HH%%Min%"
@cp6
cp6 / youtube_sub_last_upload.php
Created July 9, 2018 06:47
View when your YouTube subscribed last upload was
<?php
ini_set('max_execution_time', 120);//2 minutes
error_reporting(0);
$api_key = '';//Your YouTube/Google api key
$your_ch_id = '';//YOur YouTube channel id
function call_api($call, $type)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $call);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
@cp6
cp6 / dayz_61_classes.json
Created August 16, 2018 13:18
DayZ all class names .61
[{
"class": "DZ_LightAI"
}, {
"class": "HouseNoDestruct"
}, {
"class": "InventoryBase"
}, {
"class": "ContainerBase"
}, {
"class": "FixedContainer"
@cp6
cp6 / rhs_class.json
Created August 16, 2018 13:31
All Arma 3 RHS classnames 2018
[
{
"class":"10Rnd_RHS_50BMG_Box"
},
{
"class":"1_Rnd_RHS_9M79B"
},
{
"class":"1_Rnd_RHS_9M79_1_F"
},
@cp6
cp6 / bunnycdn_storage.php
Last active January 3, 2021 19:05
Bunny CDN Storage API format
<?php
header("Content-type:application/json");
function storage($key, $dir = '')
{
return json_decode(file_get_contents("https://storage.bunnycdn.com/" . $dir . "/?AccessKey=" . $key . ""), true);
}
$array = storage('STORAGE-PASSWORD-HERE', 'STORAGENAME');
$items = array('data' => array());
foreach ($array as $value) {
@cp6
cp6 / type.txt
Created September 24, 2018 01:05
DayZ type.xml dump Item names
ACOGOptic
AgaricusMushroom
AKM
AK_Suppressor
AK_WoodBttstck
AK_WoodHndgrd
AliceBag_Black
AliceBag_Camo
AliceBag_Green
AmanitaMushroom
@cp6
cp6 / bcdn_ftp_upload.php
Created October 22, 2018 08:03
BunnyCDN PHP FTP upload
<?php
function uploadFTP($server, $username, $password, $file_to_upload, $save_file_as){
$connection = ftp_connect($server);
if (@ftp_login($connection, $username, $password)){
// connection success
}else{
return "Error connecting to $server";
}
ftp_pasv($connection, true);
ftp_put($connection, $save_file_as, $file_to_upload, FTP_BINARY);
@cp6
cp6 / LAC_fixture.txt
Created October 31, 2018 05:32
LAC fixture 2018/19 NBA
GAMENUMBER_HOME_AWAY
1_LAC_DEN
2_LAC_OKC
3_LAC_HOU
4_NOP_LAC
5_HOU_LAC
6_LAC_WAS
7_OKC_LAC
8_PHI_LAC
9_ORL_LAC
@cp6
cp6 / pdo_examples.php
Last active July 4, 2023 22:04
PHP PDO MySQL cheat sheet
<?php
//Create connection
$db = new PDO('mysql:host=localhost;dbname=DATABASENAME;charset=utf8mb4', 'USERNAME', 'PASSWORD');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);//https://www.php.net/manual/en/pdo.setattribute.php
//Check connection status
echo $db->getAttribute(PDO::ATTR_CONNECTION_STATUS);
//SELECT with loop
$select = $db->prepare("SELECT `col`, `col2` FROM `table`");
@cp6
cp6 / loop_columns.php
Last active July 12, 2020 01:56
PHP MySQL loop with Bootstrap 4 columns
<style>
body {
background: #0d161f;
}
.row {
background: #00b9eb;
padding: .4rem;
margin-top: .6rem;
text-align: center;
}