Skip to content

Instantly share code, notes, and snippets.

View nokimaro's full-sized avatar

Nik Dm nokimaro

View GitHub Profile
@nokimaro
nokimaro / webhook.php
Created May 22, 2021 20:45 — forked from jplitza/webhook.php
A basic PHP webhook handler for Github, just verifying the signature and some variables before calling another command to do the actual work
<?php
// where to log errors and successful requests
define('LOGFILE', '/tmp/github-webhook.log');
// what command to execute upon retrieval of a valid push event
$cmd = 'update-jekyll.sh 2>&1';
// the shared secret, used to sign the POST data (using HMAC with SHA1)
$secret = '00000000000000000000000000000000';
@nokimaro
nokimaro / ubuntu_enable_bbr.sh
Created August 3, 2020 14:10 — forked from Jamesits/ubuntu_enable_bbr.sh
Ubuntu enable BBR
#!/bin/bash
set -eu
SYSCTL_FILE=/etc/sysctl.d/90-tcp-bbr.conf
# check root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
@nokimaro
nokimaro / SimpleStore.js
Created May 18, 2018 17:02 — forked from ksafranski/SimpleStore.js
Simple localStorage function with Cookie fallback for older browsers.
/**
* Simple localStorage with Cookie Fallback
* v.1.0.0
*
* USAGE:
* ----------------------------------------
* Set New / Modify:
* store('my_key', 'some_value');
*
* Retrieve:
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@nokimaro
nokimaro / autofit_text_to_image.php
Created January 23, 2018 16:55 — forked from clifgriffin/autofit_text_to_image.php
Auto fit text to image using PHP / Imagick
<?php
/**
* Auto Fit Text To Image
*
* Write text to image using a target width, height, and starting font size.
*
* @author Clif Griffin
* @url http://cgd.io/2014/auto-fit-text-to-an-image-with-php-and-wordpress
*
@nokimaro
nokimaro / LICENSE.txt
Created December 18, 2016 01:58 — forked from dciccale/LICENSE.txt
Detect if Flash Player is installed in your browser (120bytes)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Denis Ciccale <http://webdecs.wordpress.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@nokimaro
nokimaro / is_popup_window.js
Created December 18, 2016 01:58 — forked from donut/is_popup_window.js
Is popup window
// Try to guess if the current window is a "popup"
window.isPopup =
window.isPopup || window.opener ||
(window.locationbar && window.locationbar.visible === false) ||
false;

###Важно! Необходимо перед установкой данного кода, удалить наш старый код

<script async src="http://show.octobird.com/ob.js"></script>
<div class="octobird-block" 
    data-site-id="3510" 
    data-ad-type="img" 
    data-ad-number="1"></div>

Для отображения собственной рекламы, при отсутствии рекламы из octobird, добавляется параметр passback с собственным обработчиком.

<div class="octobird-block"></div>

<script type="text/javascript">
    var _ob = {
        sid: YOUR_SITE_ID,
        passback: function () {
            //ЗДЕСЬ РЕАЛИЗУЕТСЯ ВАША ЛОГИКА, КОТОРАЯ ВЫПОЛНЯЕТСЯ ПРИ ОТСУТСТВИИ РЕКЛАМЫ В OCTOBIRD 
 console.log('Octobird does not have any ads');