Skip to content

Instantly share code, notes, and snippets.

@adobkin
adobkin / dist.sh
Created July 6, 2011 09:03
Simple script for getting OS name and it's version
#!/bin/sh
# This is simple script for getting OS name and it's version
# Script outputs the string in the format: dist_name-dist_version
# e.g. fedora-14
os=$(uname -s)
dist_name='unknown'
dist_version='unknown'
case "${os}" in
@adobkin
adobkin / FindCUnit.cmake
Created July 9, 2011 05:28
Module for CMake to search the CUnit headers and libraries
# Find the CUnit headers and libraries
#
# CUNIT_INCLUDE_DIRS - The CUnit include directory (directory where CUnit/CUnit.h was found)
# CUNIT_LIBRARIES - The libraries needed to use CUnit
# CUNIT_FOUND - True if CUnit found in system
FIND_PATH(CUNIT_INCLUDE_DIR NAMES CUnit/CUnit.h)
MARK_AS_ADVANCED(CUNIT_INCLUDE_DIR)
# Когда в интерактивном режиме
case $- in *i*)
if [ "x$PROFILE" != "x" ]; then
# После завершения
__exit() {
[ -r /etc/ash_logout ] && . /etc/ash_logout
[ -r $HOME/.ash_logout ] && . $HOME/.ash_logout
}
# Отлавливаем сигнал завершения
trap "__exit" 0
@adobkin
adobkin / send_push.php
Last active December 27, 2019 06:20
Quickly send an Apple Push Notification from your PHP code
<?php
// APNS contex
$apn = apn_init();
apn_set_array($apn, array(
'certificate' => 'apns-dev-cert.pem',
'private_key' => 'apns-dev-key.pem',
'private_key_pass' => 'qwerty',
'mode' => APN_SANDBOX
));