Skip to content

Instantly share code, notes, and snippets.

@levelsio
levelsio / btc-eth-dca-buy.php
Last active January 6, 2023 22:04
This script runs daily and "Dollar Cost Average"-buys $40 BTC and $10 ETH per day
<?
//
// [ BUY BTC & ETH DAILY ON BITSTAMP ]
// by @levelsio
//
// 2017-08-23
//
// 1) buy $40/day BTC
// 2) buy $10/day ETH
//
@bmccormack
bmccormack / README.md
Last active November 2, 2017 18:40
Get count of tags within a Zendesk search Python script

##Before you begin

This is designed for Python 2.7. You'll need to have the requests package installed.

##Setup

  1. Setup 3 files that correspond to the 3 Python files in this gist within a single folder.
  2. In secrets.py, add your Zendesk account email and token. To get a token, from within Zendesk, go to Settings > API > Token Access (Enabled), then click the plus sign near "Active API Tokens".
  3. In query_zendesk_search_stats_tags.py, change SEARCH and ZENDESK_SUBDOMAIN for your needs.
  4. To run, type python query_zendesk_search_stats_tags.py from the command line and press enter. It will take about 2.5 seconds for each 100 tickets in the search. E.g. 811 tickets took ~22 seconds.
@keimoon
keimoon / fix_heartbleed.sh
Created April 10, 2014 03:57
OpenSSL Heartbleed patch
#!/usr/bin/env bash
DIR=`dirname $BASH_SOURCE`
test "x`whoami`" != "xroot" && echo "Please run as root" && exit
version=`openssl version`
version=${version:0:14}
test "x$version" == 'xOpenSSL 1.0.1g' && echo "OpenSSL version 1.0.1g is OK!!!" && exit
echo -n "Your OpenSSL version is $version. Are you sure to upgrade to 1.0.1g? [Y/n]: "
read confirm
test "x$confirm" != "xY" && echo "Bye" && exit
echo "Checking openssl in /usr/local/bin"
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@ck-on
ck-on / ocp.php
Last active March 25, 2024 09:30
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@mbbx6spp
mbbx6spp / install_percona.sh
Created October 10, 2012 17:07
Percona Server 5.5 unattended install on Ubuntu 11.10 (oneiric)
#!/usr/bin/env bash
PERCONA_PW=$1
DEBCONF_PREFIX="percona-server-server-5.5 percona-server-server"
[ ! $# -eq 1 ] && echo "Usage: $0 PASSWORD" && exit 1;
gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
gpg -a --export CD2EFD2A | sudo apt-key add -
sudo sh -c 'cat <<EOF >/etc/apt/sources.list.d/percona.list
@juliendsv
juliendsv / gist:3737284
Created September 17, 2012 13:32
Speedup mysql by using RAMDISK
#!/bin/bash
sudo mkdir /db/tmpfs
sudo mount -osize=256m tmpfs /db/tmpfs -t tmpfs
sudo chmod 777 /db/tmpfs
# IMPORTANT edit your /etc/apparmor.d/usr.sbin.mysqld
# to match your new path
# so /var/lib/mysql -> /db/tmpfs/mysql/ (there must be 2 links)
# Then restart apparmor /etc/init.d/apparmor restart
@sandys
sandys / etc_sites_enabled_default.nginx
Created September 4, 2012 06:40
Bulletproof Wordpress installation
proxy_cache_path /var/lib/nginx/cache/staticfiles levels=1:2 keys_zone=staticfilecache:60m inactive=90m max_size=50m;
proxy_temp_path /var/lib/nginx/proxy;
proxy_connect_timeout 30;
proxy_read_timeout 120;
proxy_send_timeout 120;
map $http_cookie $logged_in {
default 0;
~wordpress_logged_in 1; # Wordpress session cookie
@pztrick
pztrick / fancyimage_tag.rb
Created June 21, 2012 01:33
Jekyll Image plugin that dynamically creates thumbnails and fancyboxes for uploaded images
# Title: Fancyimage tag for Jekyll
# Authors: Devin Weaver (photos_tag.rb), Brian M. Clapper (img_popup.rb), Patrick Paul (this gist)
# Description: Takes full size image, automagically creates thumbnail at specified size, +fancybox
#
# Adapted from:
# http://tritarget.org/blog/2012/05/07/integrating-photos-into-octopress-using-fancybox-and-plugin/
# (photos_tag.rb) https://gist.github.com/2631877
# (img_popup.rb) https://github.com/bmc/octopress-plugins/
#
# Syntax {% photo filename [tumbnail] [title] %}
@brookr
brookr / config.ru
Created April 16, 2012 04:36
Rackup file I use for running WordPress on Pow
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com)
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /