Tuesday, October 09, 2018

Adbocker settings with FF Custom Style Script



https://www.wetteronline.de/
#topcontainer,
#premium_webcam,
#contentcontainer > div:first-of-type,
#sidebar > div:nth-of-type(2),
#sidebar > a,
#header,
#video_rotation,
.ticker-widget,
#news_slider,
#content_headline,
iframe
{display: none;}


div.boxContainer, div.pageHeaderLogo, .pageNavigation, .userNotice, ul.messageStatus, div.userRank , .messageSidebar .userAvatar {display: none;}
.pageHeaderFacade > .layoutBoundary {padding-top: 0px; padding-bottom: 0px;}
.main {padding: 20px 0;}


https://www.heise.de
.newsticker-archiv .archiv-liste__item a {border-bottom: .0625rem #c7c7c7;}
.header-main, .aufmacherbild, .ad-container,
.apester-element, #mitte_rechts, .ho .recommendations, .bottom_up,
.buehnenteaser, .akwa-ad-container, .main-footer, .beitragsfooter,
nav.a-nav, span.akwa-article-meta__item.media-icon.media-icon--comments,
div.heisetopnavi.heisetopnavi.v14,
iframe, footer, #vpaid-container
{display: none;}


https://old.reddit.com/r/haskell/
.content .infobar, .organic-listing, .side, div.footer-parent {display: 
none;}


http://www.sueddeutsche.de/
#iqd_mainAd, ul.article-sidebar-wrapper , .teaserable-layout, 
.endofarticle, div.ad.ad_iqadtile16 {display: none;}


http://www.wetter24.de/
aside.span4, header, ul.clearfix, div.span2.mg_box_simple,
div.row.footer_line, div.row.footer_block, header, h2, iframe {display: none;}



https://www.google.com/
div.rc div:nth-child(3), div#resultStats, div#extrares.med, div#footcnt, span.csb {display: none;}


Tuesday, July 24, 2018

Ways to stream yesod data to the client


model:

Rawdata
  bytes ByteString


way 1:

  addHeader "Content-Disposition" $
    T.concat ["attachment; filename=\"", filename, "\""]
  rawdata <- runDB $ get404 rawdataId                                                                                                                                         
  let bytes = rawdataBytes rawdata                                                                                                                                            
  sendResponse (TE.encodeUtf8 mimetype, toContent bytes)                                                                                                                      


way 2:

  let bytesSource = selectSource [RawdataId ==. rawdataId] []                                                                                                                 
  respondSourceDB (TE.encodeUtf8 mimetype) $ bytesSource $= awaitForever toBuilder'                                                                                           
  where                                                                                                                                                                       
    toBuilder' (Entity _ rawdata) = do                                                                                                                                        
      sendChunkBS $ rawdataBytes rawdata                                                                                                                                      
      sendFlush                                                                                                                                                               


way 3:

  let bytesSource = E.selectSource $ E.from $ \rd -> do
        E.where_ (rd E.^. RawdataId E.==. E.val rawdataId)
        return $ rd E.^. RawdataBytes
  respondSourceDB (TE.encodeUtf8 mimetype) $ bytesSource $= awaitForever toBuilder'
  where
    toBuilder' (E.Value bytes) = do
      sendChunkBS bytes
      sendFlush

Sunday, July 22, 2018

put 2 images side by side

montage *.JPG -tile 2x -geometry +0+0 result $(basename `pwd`).jpg

Monday, June 18, 2018

NixOS harddisk partitioning for 18.03


# Write random data to the disk with
dd if=/dev/urandom of=/dev/sda bs=4M status=progress

fdisk -l

fdisk /dev/sda

n
p
1
default
+420G
a

n
p
2
default
+4G
t
2
82  Linux swap

Friday, May 18, 2018

nixos haskell yesod package with overrides

create a new file my-stack-project.nix:

let
  pkgs = import  {};
  pkg = pkgs.haskellPackages.callCabal2nix "my-stack-project" ./. {};
in
  pkgs.haskell.lib.overrideCabal pkg (_: {
    doHaddock = false;
    postInstall = ''
      cp -r ./static $out/bin
      cp -r ./config $out/bin
    '';
  })

nixos haskell package without default.nix

create a new file my-stack-project.nix:

let
  pkgs = import  {};
in
  pkgs.haskellPackages.callCabal2nix "my-stack-project" ./. {}

nixos haskell package with default.nix

generate the default.nix with

cd my-stack-project
cabal2nix . > default.nix

create a new file my-stack-project.nix:

let
  pkgs = import  {};
in
  pkgs.haskellPackages.callPackage ./default.nix {}

Monday, November 06, 2017

sieve forward all mails


require ["envelope"];
if anyof (address :is ["to", "cc"] "info@mydomain.de",
          envelope "to" "info@mydomain.de")
{
    redirect "person1@mydomain.de";
    redirect "person2@mydomain.de";
    discard;
}


BTW quote good examples are here: https://support.tigertech.net/sieve

Wednesday, October 18, 2017

strato hidrive - no matching cipher found.

in case you get  errors like...

rsync -a myfile user@rsync.hidrive.strato.com:users/user 
Unable to negotiate with 85.214.3.70 port 22: no matching cipher found. Their offer: aes128-cbc,3des-cbc,blowfish-cbc
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2]

or

scp myfile user@scp.hidrive.strato.com:users/user
Unable to negotiate with 85.214.3.70 port 22: no matching cipher found. Their offer: aes128-cbc,3des-cbc,blowfish-cbc
lost connection

put this into you ~/.ssh/config

host strato-scp
        hostname scp.hidrive.strato.com
        Ciphers aes128-cbc
        MACs hmac-sha1
        KexAlgorithms diffie-hellman-group1-sha1
        HostKeyAlgorithms ssh-rsa
host strato-rsync
        hostname rsync.hidrive.strato.com
        Ciphers aes128-cbc
        MACs hmac-sha1
        KexAlgorithms diffie-hellman-group1-sha1
        HostKeyAlgorithms ssh-rsa

And then connect with

rsync -a myfile user@strato-rsync:users/user
scp myfile user@strato-scp:users/user

Tuesday, October 17, 2017

haskell set file modes


import System.Posix.Files (setFileMode, groupReadMode)
import System.Directory (getDirectoryContents)

tmpFilePaths <- liftIO $ getDirectoryContents staticDir
forM_ tmpFilePaths (\path -> do
                               liftIO $ setFileMode path groupReadMode
                   )

Tuesday, September 26, 2017

Yesod embed json in html


getPersonListR :: Handler Html
getPersonListR = do
  urlRender <- getUrlRender
  personEnts <- runDB $ selectList [] [Asc PersonId]
  let jData = map (\(Entity personId person) ->
                      JPerson { jPersonPerson = person
                              , jPersonEditFormUrl = urlRender $ PersonEditFormR personId }
                  ) personEnts
  jsonData <- returnJson jData >>= return . toJsonText
  defaultLayout $ do
    toWidgetBody [julius|var data = #{rawJS jsonData}|]
    $(widgetFile "person_list")

data JPerson = JPerson
  { jPersonPerson :: Person
  , jPersonEditFormUrl :: Text
  }

Sunday, September 17, 2017

change git user and email for previous commits


git filter-branch --commit-filter \
  'if [ "$GIT_AUTHOR_NAME" = "OLD-NAME" ]; then \                                                                                                 
      export GIT_AUTHOR_NAME="NEW-NAME";\                                                                                                               
      export GIT_AUTHOR_EMAIL=NEW-EMAIL;\                                                                                                        
      export GIT_COMMITTER_NAME="NEW-NAME";\                                                                                                            
      export GIT_COMMITTER_EMAIL=NEW-EMAIL;\                                                                                                     
  fi;\                                                                                                                                              
git commit-tree "$@"'

set git user and email for a repository


git config user.name "NEW-NAME"; git config user.email "info@..."

Thursday, May 12, 2016

Wednesday, January 06, 2016

generate favicon

generate favicon...
http://www.favicate.de/

unzip here if Mac cannot unzip it...
http://online.b1.org/online#

email client mutt forward message with attachment

got the info from here http://shallowsky.com/blog/linux/mutt-fwd-attachments.html

type v to get to the attachments screen

type t repeatedly to tag all the attachments, including the initial small text/plain attachment (that's the original message body)

When they're all tagged, type f (forward all tagged attachments)

After you fill in the To: prompt, you'll be able to edit the message body, and when you leave the editor, you'll have the attachment list there to edit as you see fit. 

Wednesday, December 30, 2015

haskell yesod curl POST request ... handling CSRF


get the cookie with token in it:

$ curl -c cookie.txt http://localhost:3000/

$ cat cookie.txt 
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

#HttpOnly_localhost FALSE / FALSE 1451524550 _SESSION gxV1yVNefLhiS7K3/ukfWWi5GXfD7wXfwJFYDXk3fz/HvyPqcSIcU7BBIKdOrj0jrpcU9DroL0+ioD3rr8cbvCSy+A+jPDpt/8kkiSPjYE86cGyTiueVo2cOGWcc8=
localhost FALSE / FALSE 0 XSRF-TOKEN seQLdve8GY


use token:

$ curl -v \
    --cookie cookie.txt \
    -c cookie.txt \
    -H "x-xsrf-token: seQLdve8GY" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -X POST \
    -d '{"foo":"bar", ...}' \
    http://localhost:3000/updateDruckprodukt