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 / start_bec.bat
Last active May 7, 2024 00:21
DayZ server start up batch file examples
@echo off
:start
::Server name
set serverName=Server1
::Server files location
set serverLocation="C:\Program Files (x86)\Steam\steamapps\common\DayZServer"
::Server Profile folder
set profile=Server1
::BEC location
set BECLocation="C:\Program Files (x86)\Steam\steamapps\common\DayZServer\BEC"
@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 / pdo_mysql_backup.php
Last active February 20, 2024 12:41
PHP PDO MySQL backup script with compression
<?php
$backup_config = array(
'DB_HOST' => '127.0.0.1',////Database hostname
'DB_NAME' => 'test_db',//Database name to backup
'DB_USERNAME' => 'root',//Database account username
'DB_PASSWORD' => '',//Database account password
'INCLUDE_DROP_TABLE' => false,//Include DROP TABLE IF EXISTS
'SAVE_DIR' => '',//Folder to save file in
'SAVE_AS' => 'test_db-',//Prepend filename
'APPEND_DATE_FORMAT' => 'Y-m-d-H-i',//Append date to file name
@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 / tennis_function.php
Created March 2, 2023 01:03
PHP tennis score function
<?php
//$series = [];
//$series = ['Jimmy'];
//$series = ['Lisa'];
//$series = ['Jimmy', 'Lisa'];
//$series = ['Jimmy', 'Lisa', 'Jimmy'];
//$series = ['Jimmy', 'Lisa', 'Jimmy', 'Lisa'];
//$series = ['Jimmy', 'Lisa', 'Jimmy', 'Jimmy'];
//$series = ['Jimmy', 'Jimmy', 'Jimmy'];
@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 / 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 / map.php
Created June 23, 2020 01:38
Leaflet map latitude and longitude marker with PHP
<?php
if (isset($_GET['lat']) && isset($_GET['lon'])) {
$lat = $_GET['lat'];
$lon = $_GET['lon'];
} else {
echo "<h1>Latitude and Longitude must be set in URL</h1>";
echo "<p>Example: <a href='map.php?lat=-37.818217&lon=144.956784'>map.php?lat=-37.818217&lon=144.956784</a></p>";
exit;
}
?>
@cp6
cp6 / table_func.php
Created September 24, 2020 03:41
PHP function for making HTML tables
<?php
function outputString(string $string)
{
echo $string;
}
function tableBuilder(array $theads, array $data, string $table_class = 'table', string $thead_class = '')
{
(empty($table_class)) ? $tbl = "" : $tbl = " class='$table_class'";
(empty($thead_class)) ? $th = "" : $th = " class='$thead_class'";
@cp6
cp6 / get_all.php
Created August 7, 2019 13:00
Get all videos YouTube api
<?php
$yt_channel_id = '';//YouTube Channel id
$yt_api_key = '';//YouTube API key
function list_videos_w_page($chid, $api_key, $page_token = '')
{
global $yt_channel_id;
global $yt_api_key;
if ($page_token == '') {
$data = json_decode(file_get_contents("https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=" . $chid . "&maxResults=50&order=date&type=video&key=$yt_api_key"), true);
} else {