Skip to content

Instantly share code, notes, and snippets.

View iamacarpet's full-sized avatar

Samuel iamacarpet

View GitHub Profile
" Vim syntax file
" Language: YAML (YAML Ain't Markup Language) 1.2
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
" First author: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2010-10-08
if exists('b:current_syntax')
finish
endif
_____ ____
_/ ____\_ _ __ /_ |
\ __\\ \/ \/ / ______ | |
| | \ / /_____/ | |
|__| \/\_/ |___|
_____ ________
_/ ____\_ _ __ \_____ \
\ __\\ \/ \/ / ______ / ____/
| | \ / /_____/ / \
|__| \/\_/ \_______ \
\/
@iamacarpet
iamacarpet / gist:6869643
Created October 7, 2013 15:13
FuelPHP Database Config Driver
<?php
namespace Fuel\Core;
/**
* JSON Config file parser
*/
class Config_Db extends \Config_File
{
protected $ext = '.db';
diff --git a/letsencrypt/plugins/webroot.py b/letsencrypt/plugins/webroot.py
index 42bfe31..d42c3a5 100644
--- a/letsencrypt/plugins/webroot.py
+++ b/letsencrypt/plugins/webroot.py
@@ -41,6 +41,7 @@ and reload your daemon.
import errno
import logging
import os
+import sys
@iamacarpet
iamacarpet / SoapClientGuzzle.php
Created July 4, 2017 14:10
SoapClientGuzzle extends \SoapClient
<?php
namespace App;
use GuzzleHttp\Psr7;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
class SoapClientGuzzle extends \SoapClient
@iamacarpet
iamacarpet / gist:2944f1ee372ee0a44d07a2351ceb39b3
Created January 17, 2018 15:20
BigQuery (Legacy SQL) - Cloudflare Enterprise Log Share - User Agent Browser Version
-- Looking towards the "Legacy TLS" turndown in June 2018,
-- we needed to analyse which devices / browsers are still accessing, by parsing the User Agent.
-- This is in BigQuery Legacy SQL, with field names based on Cloudflare's Enterprise Log Share data.
CASE
WHEN ClientRequestUserAgent LIKE '%Windows Phone%' THEN CONCAT('Windows Phone/', IF(REGEXP_MATCH(ClientRequestUserAgent, r'Windows Phone ([0-9\.]+);'), REGEXP_EXTRACT(ClientRequestUserAgent, r'Windows Phone ([0-9\.]+);'), 'UNKNOWN'))
WHEN ClientRequestUserAgent LIKE '%MSIE%' THEN CONCAT('MSIE/', IF(REGEXP_MATCH(ClientRequestUserAgent, r'MSIE ([0-9\.]+)'), REGEXP_EXTRACT(ClientRequestUserAgent, r'MSIE ([0-9\.]+)'), 'UNKNOWN'))
WHEN ClientRequestUserAgent LIKE '%Trident%' THEN CONCAT('MSIE/Trident/', IF(REGEXP_MATCH(ClientRequestUserAgent, r'Trident/([0-9\.]+)'), REGEXP_EXTRACT(ClientRequestUserAgent, r'Trident/([0-9\.]+)'), 'UNKNOWN'))
WHEN ClientRequestUserAgent LIKE '%Firefox%' THEN CONCAT('Firefox/', IF(REGEXP_MATCH(ClientRequestUserAgent, r'Fi
func openFileReader(ctx context.Context, bucketName, fileName string) (*storage.Reader, error) {
client, err := storage.NewClient(ctx)
if err != nil {
log.Errorf(ctx, "Error getting GCS Client: %s", err)
return nil, err
}
defer client.Close()
bucket := client.Bucket(bucketName)
@iamacarpet
iamacarpet / app.yaml
Created October 18, 2018 08:30
App Engine Go 1.11 memcache proof
runtime: go111
@iamacarpet
iamacarpet / teamsupdate.ps1
Created September 23, 2021 11:05
Force a Microsoft Teams update
$ProgressPreference = 'SilentlyContinue'
$TeamsSettings = $HOME + "\AppData\Roaming\Microsoft\Teams\settings.json"
$Setting = Get-Content $TeamsSettings -ErrorAction Continue | ConvertFrom-Json | Select Version
$Version = $Setting.Version
echo "Checking for updates..."
$UpdateInfo = curl "https://teams.microsoft.com/desktopclient/update/$Version/windows/x64?ring=general"
$UpdateData = $UpdateInfo | ConvertFrom-json