Skip to content

Instantly share code, notes, and snippets.

View fbehrens's full-sized avatar
🎯
Focusing

Frank Behrens fbehrens

🎯
Focusing
  • https://github.com/Bayer-Group
  • Cologne - Germany
  • X @bluse1995
View GitHub Profile
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet-fsharp
{
"name": "F# (.NET)",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/dotnet:0-6.0-bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/node:1": {
@fbehrens
fbehrens / readme.md
Last active October 24, 2021 15:20
UISP Mobile

Product: LiteBeam 5AC Gen2

Webinterface setup.ubnt.com Captive Portal: insecure certificate (not thrusted) Serial: b3d5a4dc Thumbprint (sha1): 50933389 A677D7C3 0C125876 7AE9F0B5 8E299FBE -> Difficult to use because certificate is not trusted

@fbehrens
fbehrens / trigger.sql
Last active August 23, 2021 13:38
tsql autid trigger.sql
/*
DROP TABLE GUESTS
go
CREATE TABLE GUESTS (
ID int IDENTITY(1,1) PRIMARY KEY,
NAME VARCHAR(50),
SURNAME VARCHAR(50),
)
DROP TABLE Audit
ipmo Microsoft.PowerShell.ConsoleGuiTools
$global:sysCode="C:\Users\fb\code"
if( $null -ne (get-psreadlineOption).PredictionSource ) {
Set-PSReadLineOption -PredictionSource History }
if( $null -ne (get-psreadlineOption).PredictionViewStyle ) {
Set-PSReadLineOption -PredictionViewStyle ListView }
function glg{
@fbehrens
fbehrens / barcodeLeb.fsx
Last active December 16, 2020 20:12
use Barcode lib
// Microsoft (R) F# Interactive version 11.0.0.0 for F# 5.0
// #r "C:/Users/fb/OneDrive/code/schnelltest/etc/barcodelib/BarcodeStandard/bin/Debug/netstandard2.0/BarcodeStandard.dll"
// #r "System.Drawing.Common"
// or
#r "nuget: BarcodeLib"
open BarcodeLib
open System.Drawing
let b = new Barcode()
filter Decode { [System.Net.WebUtility]::UrlDecode($_) }
filter Get-Songs{
$xml = New-Object XML.XmlDocument
$xml.LoadXml((Get-Content $_))
$disk = $xml.BPP.disc
$outFile = $_.name -replace "\.bpp$",".mp3"
$(0..($disk.path.Length -1) | % {
"$($disk.path[$_].src | Decode)$($disk.file[$_].src | Decode)"
} )> $outFile
@fbehrens
fbehrens / HashFromCsv.ps1
Created February 26, 2020 21:15
PSReadline Handler
Set-PSReadLineKeyHandler -Chord F2 -BriefDescription HashFromCsv -LongDescription "converts a comma separated String int a Hashtable" -ScriptBlock { param($key, $arg)
$line = $null
$cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
$g = [Regex]::matches($line,"\S+") | ? { $_.index -le $cursor -and $_.index + $_.Length -ge $cursor }
if (!$g){ return }
$s = $g.value -replace ",",'="";'
$s = "@{$s=`"`"}"
$pos = $s.IndexOf('""')
[Microsoft.PowerShell.PSConsoleReadLine]::Replace($g.Index,$g.Length,$s)
@fbehrens
fbehrens / csv.fs
Created November 11, 2015 09:50
Hourly filtering
module wba.csv
open FSharp.Data
open System
type Stocks = CsvProvider<"ES.csv", Schema = "Date(string),Time(string),Open,High,Low,Close,Volume">
let getTime (row:Stocks.Row) =
let iC = Globalization.CultureInfo.InvariantCulture
let s = row.Date + " " + row.Time
DateTime.ParseExact(s, "MM/dd/yyyy HHmm",iC)
@fbehrens
fbehrens / gist:2056193
Created March 17, 2012 07:35
Using multiple databases in Active Record
equire 'oci8'
require 'activerecord-oracle_enhanced-adapter'
require 'active_record'
class Db1 < ActiveRecord::Base
self.abstract_class = true
establish_connection YAML.load_file('config/database.yml')['db1']
end
class Db2 < ActiveRecord::Base
@fbehrens
fbehrens / monitor.rb
Created February 20, 2011 11:59
litte script which monitors my internetconnection
#!/usr/bin/ruby -w
# this is an example of uncommunicative code
# would be a good example for refactoring to make clear what it does
class Monitor
@@host = "heise.de"
@@tries = 4
@@results_per_line = 60
@@log = __FILE__.gsub(/rb$/,"log")