Skip to content

Instantly share code, notes, and snippets.

@jackcarter
jackcarter / slack_delete.py
Last active November 29, 2023 07:03
Delete Slack files older than 30 days. Rewrite of https://gist.github.com/jamescmartinez/909401b19c0f779fc9c1
import requests
import time
import json
token = ''
#Delete files older than this:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():
# A sample Logstash configuration to parse logs shipped with rsyslog.
# See also information about
input {
file {
path => "/var/log/rsyslog/*/*.log"
exclude => "*.bz2"
type => syslog
sincedb_path => "/var/run/logstash/sincedb"
sincedb_write_interval => 10
@Synchro
Synchro / gist:5917252
Last active March 18, 2016 16:59
Logstash config for parsing drupal watchdog log entries. Greps the syslog_program source first to check it's logged by drupal, then takes apart the watchdog log pattern. See: https://api.drupal.org/api/drupal/modules!syslog!syslog.module/function/syslog_watchdog/7
grep {
type => "syslog"
match => [ "syslog_program", "drupal" ]
add_tag => "Drupal"
drop => false
}
grok {
type => "syslog"
tags => [ "Drupal" ]
match => [ "@message", "^https?://%{HOSTNAME:drupal_vhost}\|%{NUMBER:drupal_timestamp}\|(?<drupal_action>[^\|]*)\|%{IP:drupal_ip}\|(?<drupal_request_uri>[^\|]*)\|(?<drupal_referer>[^\|]*)\|(?<drupal_uid>[^\|]*)\|(?<drupal_link>[^\|]*)\|(?<drupal_message>.*)" ]
@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
<?php
// Register our shutdown function so that no other shutdown functions run before this one.
// This shutdown function calls exit(), immediately short-circuiting any other shutdown functions,
// such as those registered by the devel.module for statistics.
register_shutdown_function('status_shutdown');
function status_shutdown() {
exit();
}
// Drupal bootstrap.
@jarus
jarus / test.py
Created August 21, 2011 14:52
Testing Flask application with basic authentication
import base64
from myapplication import app
class MyTestCase(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
def tearDown(self):
pass
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code