Skip to content

Instantly share code, notes, and snippets.

View pinscript's full-sized avatar

Alexander Berg pinscript

View GitHub Profile
@pinscript
pinscript / Chromium-at-startup.md
Created November 12, 2021 13:36 — forked from rampfox/Chromium-at-startup.md
How to open Chromium in full screen at startup on the Raspberry Pi

First, it seems that ~/.config/lxsession/LXDE-pi/autostart does not exist by default.

  1. copy the autostart
cp /etc/xdg/lxsession/LXDE-pi/autostart ~/.config/lxsession/LXDE-pi/
@pinscript
pinscript / gist:0f0c1f453e5cf9f9b0010015f6a75738
Created September 24, 2021 07:01
logstash.conf for HAProxy with custom captured request/response headers
input {
beats {
port => 5044
}
tcp {
port => 5000
}
}
@pinscript
pinscript / app.py
Created May 24, 2019 19:59
Flask application to write the specified value to a HID device (RPI Zero in my case)
import time
import sys
from flask import Flask
from flask import request
NULL_CHAR = chr(0)
EOL_SEQ = NULL_CHAR*5
RELEASE_SEQ = NULL_CHAR*8
KEYMAP = {
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServer
Enable-WindowsOptionalFeature -Online -FeatureName IIS-CommonHttpFeatures
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpErrors
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpRedirect
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationDevelopment
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HealthAndDiagnostics
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpLogging
Enable-WindowsOptionalFeature -Online -FeatureName IIS-LoggingLibraries
Function Compress-Images() {
if(!(Test-Path -Path "Compressed")) {
New-Item -ItemType Directory -Force -Path "Compressed"
}
if((Get-Command "guetzli_windows_x86-64.exe" -ErrorAction SilentlyContinue) -eq $null) {
Write-Host "Could not find guetzli_windows_x86-64.exe in path."
}
$files = Get-ChildItem -Filter *.jpg
@pinscript
pinscript / main.go
Created August 8, 2016 20:21
Game of life
package main
import (
"fmt"
"flag"
"time"
"github.com/fatih/color"
)
// Based on https://gist.github.com/automatonic/3725443
// with added Hash(string input) method and removed (int) cast to
// keep the hash unsigned.
public static class MurMurHash3
{
//Change to suit your needs
const uint seed = 144;
public static long Hash(string input)
{
@extends('layouts/master')
@section('content')
<div id="main" style="width: 80%; float: left; background-color: #fefefe;">
@yield('content-child')
</div>
<div id="sidebar" style="width: 20%; float: left; background-color: #33333;">
@yield('sidebar')
</div>
@endsection
@pinscript
pinscript / getIP.js
Created August 25, 2015 06:49
Google Spreadsheet function to lookup IP for a hostname
function getIP(host) {
var url = "https://freegeoip.net/json/" + host;
var json = UrlFetchApp.fetch(url);
var data = JSON.parse(json);
return data["ip"];
}
@pinscript
pinscript / slow-loading.cs
Created August 20, 2015 07:09
Log slow loading pages using ASP.NET MVC
public class BaseModule : IHttpModule
{
private const double Treshold = 5;
private string _filePath;
public void Init(HttpApplication context)
{
_filePath = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data");
context.PreRequestHandlerExecute += PreRequestHandler;