Skip to content

Instantly share code, notes, and snippets.

View marcinlawnik's full-sized avatar

Marcin Ławniczak marcinlawnik

View GitHub Profile
>badz mno
>chciej popracowac nad projektem z ZSP
>chciej polaczyc TIA Portal z Factory IO
>dowiedz sie, ze potrzebujesz symulatora PLCSIM marki Siemens, zeby zasymulowac PLC
>chciej go pobrac
>probuj sie zalogowac
>nieprawidlowe haslo
>kliknij reset password
>podaj swoj login
>nie dostan maila
@marcinlawnik
marcinlawnik / Stolarka Studio
Created November 4, 2017 20:11
Stolarka Studio
>Chcę sam zrobić stół.
>Żeby zrobić stół, muszę kupić sobie stół stolarski Stolarka Studio. Robię na niego miejsce w garażu.
>Okazuje się, że ma 10 metrów na 5 metrów i waży 900 kg.
>Trochę duży, ale trudno. Ściągam go do garażu.
>Dociera po tygodniu i okazuje się, że 900 kg ważył blat i jedna noga. Muszę osobno sprowadzić trzy pozostałe.
>Kolejne 300 kg.
>Trzy dni później mam nogi, próbuję je przyczepić do blatu, ale każda ma inną długość.
>Sciągam z domu książki i podkładam tak, żeby było w miarę prosto.
>Zacieram ręce, chcę się zabrać do roboty.
>Nie mam narzędzi.
@marcinlawnik
marcinlawnik / qimg_image_conv.cpp
Created May 21, 2017 15:22 — forked from pelsedyr/qimg_image_conv.cpp
Conversion between QImage and Magick::Image. Tested and reliable.
Image* MainWindow::toImage(QImage* qimage)
{
qDebug() << "toImage:" << qimage->width() << qimage->height();
Image *newImage = new Image(Magick::Geometry(qimage->width(), qimage->height()), Magick::ColorRGB(0.5, 0.2, 0.3));
double scale = 1 / 256.0;
newImage->modifyImage();
Magick::PixelPacket *pixels;
Magick::ColorRGB mgc;
#!/usr/bin/env python
# based on http://stackoverflow.com/questions/7052947/split-95mb-json-array-into-smaller-chunks
# usage: python json-split filename.json
# produces multiple filename_0.json of 1.49 MB size
import json
import sys
with open(sys.argv[1],'r') as infile:
o = json.load(infile)
//less code
.mw-echo-icon-cog {
/* @embed */
background-image: url(../icons/SettingsSmall.png) no-repeat 20px 15px !important;
background-image: -webkit-linear-gradient(transparent, transparent), e('/* @embed */') url(../icons/Settings.svg) no-repeat 20px 15px !important;
background-image: linear-gradient(transparent, transparent), e('/* @embed */') url(../icons/Settings.svg) no-repeat 20px 15px !important;
}
//generated invalid css
// in firefox its empty
@marcinlawnik
marcinlawnik / gist:91b33d48fb56f55477a1
Created July 30, 2014 21:16
Laravel route active
New (n)Fork (f)Raw (r)Copy URL (cmd+c)
Please note that all pasted data is publicly available.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{{ $title }}}</title>
//Simple maintenance filter for prefixes
//How to make it work for specific routes
// app/routes.php
/*
|--------------------------------------------------------------------------
| Maintenance per-route Filter
|--------------------------------------------------------------------------
/****************
* drones101.js *
****************
*
* Do you remember, my dear Professor, a certain introductory
* computational rationality class you taught long ago? Assignment
* #2, behavior functions of autonomous agents? I remember that one
* fondly - but attack drones are so much easier to reason about
* when they're not staring you in the face, I would imagine!
@marcinlawnik
marcinlawnik / gist:9583010
Created March 16, 2014 13:13
Scraping the darwin awards page
curl 'http://darwinawards.com/darwin/darwin[1993-2013].html' -o '#1.html'
cat *.html | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2 | sort | uniq | grep -o -E '^.*darwin.*$' | grep -v '/' | grep '-'
rm *.html
#!/bin/sh
while read line
do
echo "http://darwinawards.com/darwin/$line">>url2.txt
done < url.txt
@marcinlawnik
marcinlawnik / gist:7327249
Created November 5, 2013 22:11
A simple script to download audio from yt and upload to gdrive, requires rg3/youtube-dl and gdrive
#!/bin/bash
youtube-dl -i -x -a list.txt
for file in *.m4a; do gdrive upload --file "$file"; done
find . -type f | wc -l