Skip to content

Instantly share code, notes, and snippets.

@brianmed
brianmed / minion_001.conf
Created May 23, 2016 23:50
Minion upstart and CentOS
# Start when system enters runlevel 2 (multi-user mode).
start on runlevel 3
# Start delayed_job via the daemon control script.
exec su -c "/opt/perl script/app minion worker" bpm
# Restart the process if it dies with a signal
# or exit code not given by the 'normal exit' stanza.
respawn
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@Chandler
Chandler / slack_history.py
Last active March 27, 2025 01:16
Download Slack Channel/PrivateChannel/DirectMessage History
print("UPDATE AUG 2023: this script is beyond old and broken")
print("You may find interesting and more up to date resources in the comments of the gist")
exit()
from slacker import Slacker
import json
import argparse
import os
# This script finds all channels, private channels and direct messages
use Mojolicious::Lite;
use Mojo::EventEmitter;
helper events => sub { state $events = Mojo::EventEmitter->new };
get '/' => 'chat';
websocket '/channel' => sub {
my $c = shift;
#!/usr/bin/perl
# Mojo::DOM を使い、
# DOM form オブジェクトのパラメータを取り出す例
use Mojo::DOM;
use Data::Dumper;
my $text = do { local $/ = undef; <DATA> };
my $dom = Mojo::DOM->new($text);
my $forms = forms($dom);
print Data::Dumper->Dump( [$forms] ), "\n";
@pixeline
pixeline / ajax-handler-wp.php
Last active October 5, 2022 13:09
Custom ajax handler for Wordpress. Using admin-ajax.php, as is usually recommended, is very slow and does not allow the use of plugin shortcodes. Using a custom ajax handler like this bypasses that. http://wordpress.stackexchange.com/questions/170808/the-content-shows-shortcode-instead-of-parsing-it
<?php
/*
WORDPRESS SPECIFIC AJAX HANDLER (because admin-ajax.php does not render plugin shortcodes).
by alexandre@pixeline.be
credits: Raz Ohad https://coderwall.com/p/of7y2q/faster-ajax-for-wordpress
*/
//mimic the actual admin-ajax
define('DOING_AJAX', true);
if (!isset( $_REQUEST['action']))
@seebz
seebz / iCal.php
Last active September 6, 2024 02:33
iCal PHP Parser
<?php
class iCal
{
/**
* @var string
*/
public $title;
@gavinandresen
gavinandresen / BlockPropagation.md
Last active August 6, 2026 15:55
O(1) block propagation

O(1) Block Propagation

The problem

Bitcoin miners want their newly-found blocks to propagate across the network as quickly as possible, because every millisecond of delay increases the chances that another block, found at about the same time, wins the "block race."

@ernix
ernix / plenv-install-perl-5.8.9-i386.sh
Created April 28, 2014 07:46
Install 32bit perl on Mac OSX with plenv
plenv install 5.8.9 \
-Dcc=gcc \
-Dld=g++ \
-Dusethreads \
-Duseithreads \
-Duseshrplib \
-Accflags="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk" \
-Accflags="-mmacosx-version-min=10.6" \
-Accflags="-arch i386 -DUSE_SITECUSTOMIZE -Duselargefiles" \
-Aldflags="-Wl,-search_paths_first -arch i386" \
@ciaranarcher
ciaranarcher / golang-cheat.md
Last active December 27, 2018 14:26
golang cheatsheet

Types

type Vertex struct {
    Lat, Long float64
}

Maps