Skip to content

Instantly share code, notes, and snippets.

View ayseff's full-sized avatar
🎯
Focusing

Avraham Seff ayseff

🎯
Focusing
  • Greater New York City Area
View GitHub Profile
@ayseff
ayseff / hi.py
Last active August 3, 2018 19:53
Who Knows?
import base64
valueRaw = 'R29vZGJ5ZSwgd29ybGQuICBTaW5jZXJlbHksIEtpbSBKb25nIFVuLiAgVGhhbmtzLCBCZW4gZm9yIHlvdXIgZW5jb3VyYWdlbWVudC4='
value = base64.b64decode(valueRaw).decode('utf-8')
img_data = b'/9j/4AAQSkZJRgABAQEAAAAAAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAGQAZADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxE
@ayseff
ayseff / HelloWorldController.cs
Created January 21, 2018 03:35 — forked from AlexZeitler/HelloWorldController.cs
A super simple "Hello World" Controller for ASP.NET Web API
using System.Web.Http;
namespace KatanaWebApiAndStaticConsole {
public class HelloWorldController : ApiController {
public string Get() => "Hello World";
}
}
}
@ayseff
ayseff / example.cs
Created December 11, 2017 02:03 — forked from brandonmwest/example.cs
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
@ayseff
ayseff / logstash-syslog.conf
Last active November 26, 2017 19:54
Logstash Config File for Processing Data from Syslog
# this file needs to be put on the ELK server at: /etc/logstash/conf.d/logstash.conf
# for more info, see https://www.digitalocean.com/community/tutorials/how-to-centralize-logs-with-rsyslog-logstash-and-elasticsearch-on-ubuntu-14-04
# This input block will listen on port 514 for logs to come in.
# host should be an IP on the Logstash server.
# codec => "json" indicates that we expect the lines we're receiving to be in JSON format
# type => "rsyslog" is an optional identifier to help identify messaging streams in the pipeline.
input {
udp {
@ayseff
ayseff / app.config
Last active November 26, 2017 19:47 — forked from grenade/app.config
Emit log4net entries to logstash over UDP in near-realtime
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<log4net>
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
@ayseff
ayseff / WindowsFormToXaml.cs
Created October 15, 2017 20:52 — forked from CADbloke/WindowsFormToXaml.cs
Windows Forms to XAML Converter
// based on http://robrelyea.wordpress.com/2007/02/10/winforms-xaml/
// converted to an Extension Method by @CADbloke
// a list: http://msdn.microsoft.com/en-us/library/ms750559(v=vs.110).aspx
// here's moar code:http://wf2wpf.codeplex.com/SourceControl/latest but it converts source files, not actual controls.
// Here's a site that does code too http://www.win2wpf.com/
// http://www.codeproject.com/Articles/25795/Creating-the-Same-Program-in-Windows-Forms-and-WPF
// ReSharper disable SpecifyACultureInStringConversionExplicitly
using System;
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="urn:packages" xmlns="urn:packages">
<xs:element name="packages">
<xs:complexType>
<xs:sequence>
<xs:element name="package" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:string" use="required" />
<xs:attribute name="version" type="xs:string" use="required" />
@ayseff
ayseff / checkout.js
Created July 13, 2016 08:26
Bookmarklet to Checkout SVN Repository from CodePlex Using Tsvncmd Protocol
javascript:(function(){var url = window.location.host.split('.'); window.location.href = "tsvncmd:command:checkout?path:D:\\_Source Code\\CodePlex\\" + url[0] + "?url:https://" + url[0] + ".svn." + url[1] + "." + url[2] + "/svn";})();
@ayseff
ayseff / clone.js
Last active July 13, 2016 08:26
Bookmarklet to Clone Git Repository from CodePlex Using github-windows protocol
javascript:(function(){window.location.href = "github-windows://openRepo/https://git01.codeplex.com/" + window.location.host.split('.')[0];})();
@ayseff
ayseff / Remove Duplicates From packages.config.ps1
Created June 22, 2016 23:17
Remove Duplicates From packages.config
$path = "<some path>"
cls
$files = gci -Recurse -Path $path -Include packages.config
foreach($file in $files) {
[xml]$doc = $file | Get-Content
$dups = $doc.packages.package | Group-Object -Property id | Where-Object Count -GT 1 | Select Name, Count