Skip to content

Instantly share code, notes, and snippets.

View sbarre's full-sized avatar
😀
Thinking, thinking, thinking...

Seb Barre sbarre

😀
Thinking, thinking, thinking...
View GitHub Profile
@sbarre
sbarre / vote_counting.php
Last active February 6, 2018 17:47
Quick function to identify potentially duplicate votes
<?php
$votes = [];
$vote_hashes = [];
// time in seconds that must have elapsed between votes
$acceptable_time_delta = 120;
foreach ($voting_data as $row) {
@sbarre
sbarre / author.php
Created January 5, 2018 19:48 — forked from portfola/author.php
Custom User Taxonomies in WordPress
<?php
/**
* The template for displaying Profile pages.
*
* Used for Artist and Cultural Org "mini" pages.
*
* @package ArtsWestchester
* @since ArtsWestchester 1.0
*/
require "kemal"
require "jwt"
require "json"
require "yaml"
require "arangocr"
require "redis"
# Load .env file
env_data = YAML.parse File.read(".env.yml") rescue Hash(String, String).new
env_data.each { |k, v| ENV[k.to_s] = v.to_s }
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){(function(e){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(54),i=t(o),u=n(65),a=t(u),s=n(66),c=t(s),f=n(44),l=t(f),d=n(67),p=t(d),h=n(68),y=t(h),v=n(23),m=n(24),g=(t(m),n(31)),w=t(g),b=n(42),_=(t(b),n(28)),S=t(_),E=n(19),M=(t(E),n(78)),D=t(M),k=n(21),T=t(k),$=n(22),C=(t($),n(79)),x=t(C),I=n(25),R=n(26),L=(t(R),n(53)),A=t(L),N=n(80),j=t(N),O="A-58D7961E94DC7D7B14415473-2",P="//limpingline.com/1beb70a0b347952342a45dbe72002af35d2809ad3e23c60be0a952fab0e54066e89465751acc2d6e02ed909299881cc0bc72587e9ec20b5af7873c7b831aa4a365563c0a4b4393824ae1fdf2",B="",F=true,q=false,W=window,H=document.currentScript,U=H&&H.src,z="preview-engage",J=O.split("-")[1]+"-m",X=true,G=new Error("duplicate
@sbarre
sbarre / gist:9df20d5258aa847bcbba2d94608b36a4
Last active March 23, 2017 13:56
Fixing Debian/Ubuntu's default nginx configuration to work with SimpleSAMLphp

In order to make SimpleSAMLphp work properly on newer Ubuntu/Debian with a default nginx configuration, you may have to change the nginx virtual host configuration as follows:

If the PHP location block in the /etc/nginx/sites-available/default file (or whatever your default virtual host file is called) looks like this:

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                fastcgi_read_timeout 600;

 # With php7.0-fpm:
@sbarre
sbarre / slack_delete.rb
Created December 7, 2016 16:54 — forked from jamescmartinez/slack_delete.rb
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
#!/bin/bash
for file in *
do
root=$(echo $file | sed -e s/\.[^\.]*$//)
echo $root
done
<?php
class hunspell {
private $language = "en_US"; // en_US, ar, etc
private $encoding = "en_US.utf-8";
private $raw;
private $hunspellVersion;

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

Keybase proof

I hereby claim:

  • I am sbarre on github.
  • I am sbarre (https://keybase.io/sbarre) on keybase.
  • I have a public key whose fingerprint is 10A8 2E05 69A5 91AA 4911 E5AD CF2C 89D4 3A70 0656

To claim this, I am signing this object: