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
@nokimaro
nokimaro / general.conf
Last active September 23, 2021 12:00
nginx config
# favicon.ico
location = /favicon.ico {
log_not_found off;
access_log off;
}
# robots.txt
location = /robots.txt {
log_not_found off;
access_log off;
@nokimaro
nokimaro / num_emojis.php
Last active July 26, 2020 11:42
Count emojis in string
<?php
function num_emojis( $string ) {
// Array of emoji (v12, 2019) unicodes from https://unicode.org/emoji/charts/emoji-list.html
$unicodes = array( '1F600','1F603','1F604','1F601','1F606','1F605','1F923','1F602','1F642','1F643','1F609','1F60A','1F607','1F970','1F60D','1F929','1F618','1F617','263A','1F61A','1F619','1F60B','1F61B','1F61C','1F92A','1F61D','1F911','1F917','1F92D','1F92B','1F914','1F910','1F928','1F610','1F611','1F636','1F60F','1F612','1F644','1F62C','1F925','1F60C','1F614','1F62A','1F924','1F634','1F637','1F912','1F915','1F922','1F92E','1F927','1F975','1F976','1F974','1F635','1F92F','1F920','1F973','1F60E','1F913','1F9D0','1F615','1F61F','1F641','2639','1F62E','1F62F','1F632','1F633','1F97A','1F626','1F627','1F628','1F630','1F625','1F622','1F62D','1F631','1F616','1F623','1F61E','1F613','1F629','1F62B','1F971','1F624','1F621','1F620','1F92C','1F608','1F47F','1F480','2620','1F4A9','1F921','1F479','1F47A','1F47B','1F47D','1F47E','1F916','1F63A','1F638','1F639','1F63B','1F63C','1F63D','1
@nokimaro
nokimaro / vk_emojify.php
Last active January 18, 2024 21:16
replace unicode emoji with img src
<?php
function vk_emojify($string)
{
$emoji_list = array('😁','😂','😃','😄','😅','😆','😉','😊','😋','😌','😍','😏','😒','😓','😔','😖','😘','😚','😜','😝','😞','😠','😡','😢','😣','😤','😥','😨','😩','😪','😫','😭','😰','😱','😲','😳','😵','😷','😸','😹','😺','😻','😼','😽','😾','😿','🙀','🙅','🙆','🙇','🙈','🙉','🙊','🙋','🙌','🙍','🙎','🙏','🚀','🚃','🚄','🚅','🚇','🚉','🚌','🚏','🚑','🚒','🚓','🚕','🚗','🚙','🚚','🚢','🚤','🚥','🚧','🚨','🚩','🚪','🚫','🚬','🚭','🚲','🚶','🚹','🚺','🚻','🚼','🚽','🚾','🛀','🅰','🅱','🅾','🅿','🆎','🆑','🆒','🆓','🆔','🆕','🆖','🆗','🆘','🆙','🆚','🈁','🈂','🈚','🈯','🈲','🈳','🈴','🈵','🈶','🈷','🈸','🈹','🈺','🉐','🉑','🀄','🃏','🌀','🌁','🌂','🌃','🌄','🌅','🌆','🌇','🌈','🌉','🌊','🌋','🌌','🌏','🌑','🌓','🌔','🌕','🌙','🌛','🌟','🌠','🌰','🌱','🌴','🌵','🌷','🌸','🌹','🌺','🌻','🌼','🌽','🌾','🌿','🍀','🍁','🍂','🍃','🍄','🍅','🍆','🍇','🍈','🍉','🍊','🍌','🍍','🍎','🍏','🍑','🍒','🍓','🍔','🍕','🍖','🍗','🍘','🍙','🍚','🍛','🍜','🍝','🍞','🍟','🍠','🍡','🍢','🍣','🍤','🍥','🍦','🍧','🍨','🍩','🍪','🍫','🍬','🍭','🍮','🍯','🍰','🍱','🍲','🍳','🍴','🍵','🍶','🍷','🍸','🍹','🍺','🍻','🎀','🎁','🎂','🎃','🎄','🎅','🎆','🎇','🎈','🎉','🎊','🎋','🎌','🎍','🎎','🎏','🎐','🎑','🎒','🎓','🎠','🎡','🎢','🎣
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 / octobird new.md
Created November 10, 2017 01:25
Octobird anti adblock domain change

Инструкция для смены домена

Берем рекламный код в кабинете

<script async src="//show.octobird.com/loader.js"></script>
<!-- Первый -->
<div class="octobird-block"
     data-site="961"
     data-ad-slot="961-961"></div>
<script>
 (adsoctobird = window.adsoctobird || []).push({});