Skip to content

Instantly share code, notes, and snippets.

View aih's full-sized avatar

Ari Hershowitz aih

View GitHub Profile
@zomdar
zomdar / safe-html.pipe.ts
Created August 23, 2019 20:48
safeHtml pipe
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer, SafeHtml } from "@angular/platform-browser";
@Pipe({
name: 'safeHtml'
})
export class SafeHtmlPipe implements PipeTransform {
constructor(private _sanitizer:DomSanitizer) {}
@nafeu
nafeu / python3-script-template.py
Created January 29, 2019 12:34
Python3 Terminal Script Template
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Template for python3 terminal scripts.
This gist allows you to quickly create a functioning
python3 terminal script using argparse and subprocess.
"""
import argparse
@maxim
maxim / gh-dl-release
Last active July 4, 2024 00:00
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@karmi
karmi / .gitignore
Last active November 12, 2022 12:11
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@jrotello
jrotello / gist:8873462
Last active March 23, 2022 14:18
Powershell helper to ease Elasticsearch interaction without curl
function Invoke-Elasticsearch {
[CmdletBinding()]
Param(
[Uri]$Uri,
[Microsoft.PowerShell.Commands.WebRequestMethod]$Method = 'Get',
$Body = $null,
[PSCredential]$Credential
)
$headers = @{}
@aih
aih / gist:5516374
Last active December 16, 2015 23:49
XSLT to transform xml to html generically. Converts all elements to divs with class= elementName, and all attributes to data-attributes. Updated to include text nodes and format output. Elements with an "inline" attribute are converted to spans.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*" />
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
@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"

@twneale
twneale / gpolocator.py
Created January 23, 2012 05:34
Getting GPO Locator data into a more usable form
# -*- coding: utf-8 -*-
'''
Usage:
>>> f = open('usc08.10')
>>> x = getlines(f)
>>> x.next()
GPOLocatorLine(code='F', arg='5800', data=u'\r\n')
>>> print x.next().data
TITLE 8–ALIENS AND NATIONALITY
@amoilanen
amoilanen / string_search.js
Created August 2, 2011 19:13
Rabin-Karp Algorithm for Searching Strings Implemented in JavaScript
function simpleSearch(text, str) {
var matches = [];
for (var i = 0; i <= text.length; i++) {
if (matchesAtIndex(i, text, str)) {
matches.push(i);
}
}
return matches;
}