Skip to content

Instantly share code, notes, and snippets.

@dl6nm
dl6nm / Grafana-TelegramBot-HowTo.md
Last active December 13, 2023 16:21 — forked from subzeta/gist:26cd1a1f1526411862b3a3a0b4422d3d
How to create a Grafana bot for Telegram

Set up a Telegram Bot

  1. Go to Grafana > Alerting > Notification channels > New channel.
  2. Type: Telegram. It will ask you for a Bot API Token and a Chat ID.
  3. Open a chat with BotFather on Telegram.
  4. Type /newbot
  5. Type your bots name. e.g. Grafana Bot
  6. Type your bots username. e.g. a_new_grafana_bot
  7. You get your Bot API Token. Paste it on Grafana.
  8. Before making getUpdates (in the next step) you should add your bot into your telegram client and run /start. Thus you start chatting with the bot and this room is assigned chat id. (Thanks to @KES777)
@hollodotme
hollodotme / Install-php7.md
Last active August 11, 2022 06:23
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@danielbachhuber
danielbachhuber / gist:c1554c1777dbb0460bfb
Created May 12, 2014 21:58
Serve a subset of terms at /term-slug instead of /tag/term-slug
<?php
/**
* 'special-term' is a unique butterfly
*/
function dbx_get_special_terms() {
return array( 'special-term' );
}
/**
@robneu
robneu / wp-config
Created February 26, 2013 20:48
Set your GF license key in wp-config
/** Define Gravity Forms License Key */
define("GF_LICENSE_KEY", "YOUR-LICENSE-KEY-HERE");
@petenelson
petenelson / gga-marketing-request.php
Last active March 25, 2018 21:51
WordPress: Expands upon the Custom Meta Boxes library to provide a user-facing input form, list and detail page of submitted forms for custom post types.
<?php
/*
Author: Pete Nelson @GunGeekATX
Expands upon the Custom Meta Boxes library to provide a user-facing input form,
list & detail page of custom post types. This code sample doesn't include all the libraries
such as jQuery tablesorter or validate but can be found elsewhere easily enough.
*/
@clarklab
clarklab / transient-example.php
Created January 30, 2013 20:00
Caching a simple API call using the WP Transient API
<?php
//let's get some tweets!!
//first, let's see if I've got the data already cached
$tweets = get_transient("tweets");
//dang it! it looks like I might not. let's grab some tweets from the Twitter API
if( !$tweets ) {
@norcross
norcross / login-string-check.php
Created December 20, 2012 01:15
check login URL for specific query string
<?php
/*
* Check the URL of the WordPress login
* page for a specific query string
*
* assumes login string is
* http://mysite.com/wp-login.php?question=answer
*/
function rkv_login_stringcheck() {
@billerickson
billerickson / archive.php
Last active October 13, 2015 10:08
Genesis Grid - change length of content in grid
<?php
/**
* Grid Content
* Change the number of words in excerpt if in the grid loop
*/
function be_grid_content() {
// First, we make sure we're in the grid loop.
if( ! apply_filters( 'is_genesis_grid_loop', false ) )
return;
@clarklab
clarklab / gist:3902885
Created October 17, 2012 00:01
get_theme_mod
<!-- in footer.php -->
<div class="footer-text"><?php echo get_theme_mod('footer_text') ?></div>
<!-- rendered HTML content -->
<div class="footer-text">&copy;2012 Site Name</div>
<!--in functions.php (to enable the field in the Theme Customizer) -->
<?php
@billerickson
billerickson / gist:3379905
Created August 17, 2012 15:30
WordPress Security
WordPress is actually one of the most secure pieces of software available. It powers 17%
of the 1,000,000 most visited websites, so it is being constantly tested both internally
and by hackers. When an issue is discovered, an update is released which you can install
with one click in the dashboard.
The vast majority of hacked WordPress websites are running an out-of-date version of
WordPress. Once WordPress is updated, any vulnerabilities that are patched are now publicly
known, so old versions are vulnerable.
The next most likely source of hacking is your host. If your server isn't secure, it doesn't