Skip to content

Instantly share code, notes, and snippets.

View synhershko's full-sized avatar

Itamar Syn-Hershko synhershko

View GitHub Profile
@synhershko
synhershko / README.md
Last active July 14, 2018 22:25
Install Terraform Kubernetes provider

This will install an updated Terraform Kubernetes provider plugin in your Terraform working directory:

curl https://gist.githubusercontent.com/synhershko/f8c14a8031e3b756ccbf5041f6a7c253/raw/38be5292603595c541f6ad3df811e6c0be92b8df/kube-provider.sh | bash -s

As opposed to the provider maintained by HashiCorp, the provider plugin referenced here is up to date and has support for the latest Kubernetes APIs (like Deployments, Jobs, etc). Hence this script.

@synhershko
synhershko / logstash-twitter.conf
Created March 14, 2018 06:01
Twitter monitoring with Elasticsearch and Logstash
input {
twitter {
# add your data
consumer_key => "..."
consumer_secret => "..."
oauth_token => "..."
oauth_token_secret => "..."
keywords => ["newyork", "london", "bern", "paris", "sweden"]
full_tweet => true
}
@synhershko
synhershko / test.json
Created January 16, 2017 13:51
copy_to elastic search example
DELETE twitter
PUT twitter
{
"mappings": {
"tweet": {
"properties": {
"catch_all": {
"type":"text"
},
@synhershko
synhershko / keybase.md
Created January 7, 2017 16:21
keybase.md

Keybase proof

I hereby claim:

  • I am synhershko on github.
  • I am synhershko (https://keybase.io/synhershko) on keybase.
  • I have a public key whose fingerprint is 5B71 49C4 E529 4627 C105 101B 29E6 F378 1B68 8443

To claim this, I am signing this object:

@synhershko
synhershko / twitter_es_template.json
Created July 19, 2016 07:00
ES template for Twitter data
{
"template" : "twitter*",
"settings": {
"number_of_replicas" : 0, "number_of_shards" : 1,
"analysis": {
"analyzer": {
"html_keyword": {
"type":"custom",
"tokenizer": "keyword",
"char_filter": ["html_strip"]
# To run, type the following in Powershell:
# http://boxstarter.org/package/nr/url?*url to raw gist*
# Boxstarter options
$Boxstarter.RebootOk=$true # Allow reboots?
$Boxstarter.NoPassword=$true # Is this a machine with no login password?
$Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot
# Update Windows and reboot if necessary
Install-WindowsUpdate -AcceptEula
@synhershko
synhershko / DynamicContentHelpers.cs
Created August 6, 2013 20:48
Code to import WordPress dump / backup file to NSemble. Create a new Console app, add the following files, and add these as links: BlogPost.cs, Constants.cs, DynamicContent.cs, NSembleUserAuthentication.cs, PostComments.cs, User.cs
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using NSemble.Core.Models;
namespace NSemble.Core.Extensions
@synhershko
synhershko / PagesController.cs
Last active December 17, 2015 21:48
NEST Wikipedia search
public class PagesController : Controller
{
//
// GET: /Pages/
public ActionResult Search(string q)
{
var results = MvcApplication.ESClient.Search<Page>(query =>
query.Index("myindex")
.Type("page")
using System;
using Abot.Poco;
namespace Basics
{
public class Page
{
public Page(CrawledPage crawledPage)
{
var doc = crawledPage.HtmlDocument.DocumentNode;
@synhershko
synhershko / PasteInConsole.js
Last active December 13, 2015 23:19
Chrome Harlem shake - paste this in the Chrome console
JavaScript:(function(){function c(){var e=document.createElement("link");e.setAttribute("type","text/css");e.setAttribute("rel","stylesheet");e.setAttribute("href",f);e.setAttribute("class",l);document.body.appendChild(e)}function h(){var e=document.getElementsByClassName(l);for(var t=0;t<e.length;t++){document.body.removeChild(e[t])}}function p(){var e=document.createElement("div");e.setAttribute("class",a);document.body.appendChild(e);setTimeout(function(){document.body.removeChild(e)},100)}function d(e){return{height:e.offsetHeight,width:e.offsetWidth}}function v(i){var s=d(i);return s.height>e&&s.height<n&&s.width>t&&s.width<r}function m(e){var t=e;var n=0;while(!!t){n+=t.offsetTop;t=t.offsetParent}return n}function g(){var e=document.documentElement;if(!!window.innerWidth){return window.innerHeight}else if(e&&!isNaN(e.clientHeight)){return e.clientHeight}return 0}function y(){if(window.pageYOffset){return window.pageYOffset}return Math.max(document.documentElement.scrollTop,document.body.scrollTop)}funct