Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Marek Sebera smarek

💭
I may be slow to respond.
View GitHub Profile
@smarek
smarek / git.diff
Created Jul 30, 2020
kaitai tests translator python
View git.diff
diff --git a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala
index 327d3df0..0b64d616 100644
--- a/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala
+++ b/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/PythonSG.scala
@@ -56,7 +56,9 @@ class PythonSG(spec: TestSpec, provider: ClassTypeProvider) extends BaseGenerato
override def nullAssert(actual: Ast.expr): Unit = {
val actStr = translateAct(actual)
- out.puts(s"self.assertIsNone($actStr)")
+ val attrStr = actStr.substring(actStr.lastIndexOf('.') + 1)
@smarek
smarek / build.log
Created Jul 30, 2020
build-tests python
View build.log
Translating: imports_abs
[error] (run-main-0) io.kaitai.struct.precompile.ErrorInInput: imports_abs: /meta/imports/0: Unable to find 'common/vlq_base128_le' in import search paths, using: List(../../formats)
[error] io.kaitai.struct.precompile.ErrorInInput: imports_abs: /meta/imports/0: Unable to find 'common/vlq_base128_le' in import search paths, using: List(../../formats)
[error] at io.kaitai.struct.formats.JavaClassSpecs$.cached(JavaClassSpecs.scala:75)
[error] at io.kaitai.struct.formats.JavaClassSpecs.$anonfun$importAbsolute$1(JavaClassSpecs.scala:31)
[error] at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:658)
[error] at scala.util.Success.$anonfun$map$1(Try.scala:255)
[error] at scala.util.Success.map(Try.scala:213)
[error] at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
[error] at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
View AppController.php
<?php
declare(strict_types=1);
namespace App\Controller;
use Cake\Controller\Controller;
use Closure;
use ReflectionFunction;
class AppController extends Controller
@smarek
smarek / README.md
Last active Jan 24, 2021
Inflate gzdeflate contents / decode eIDAS SAMLRequest param
View README.md

Run like

> decode_saml_request.sh sample_data
@smarek
smarek / default.php
Last active Sep 19, 2019
cakephp i18n language link
View default.php
<?php
$parsed = Router::parseRequest($this->request);
unset($parsed['_matchedRoute']);
echo $this->Html->link('Čeština', array_merge($parsed, ['lang' => 'cz']));
echo ' | ';
echo $this->Html->link('English', array_merge($parsed, ['lang' => 'en']));
echo ' | ';
echo $this->Html->link('French', array_merge($parsed, ['lang' => 'fr']));
?>
@smarek
smarek / assoc.php
Created Aug 26, 2019
cakephp remove all associated fields from entity
View assoc.php
<?php
public function entityStripAssociations(Entity &$entity)
{
/** @var Table $table */
$table = TableRegistry::getTableLocator()->get($entity->getSource());
foreach ($table->associations() as $asoc) {
$entity->unsetProperty($asoc->getProperty());
}
return $entity;
}
@smarek
smarek / Identification 413c:81c2
Created Jun 21, 2019
EM7455 - Sierra Wireless - Linux
View Identification 413c:81c2
# picocom /dev/ttyUSB2
ATI
Manufacturer: Sierra Wireless, Incorporated
Model: EM7455
Revision: SWI9X30C_02.30.03.00 r7804 CARMD-EV-FRMWR2 2018/07/25 01:10:04
MEID: -redacted-
IMEI: -redacted-
IMEI SV: 17
FSN: LF818679700410
+GCAP: +CGSM
@smarek
smarek / about.md
Last active May 28, 2019
MariaDB Tarantool Replication script - now available as full project systemd-integrated, https://github.com/smarek/mariadb-tarantool-replication
@smarek
smarek / 00README.md
Last active Jul 18, 2022
E3372s-153 from Stick mode to HiLink mode automatic installer
View 00README.md

E3372s from STICK to HiLink mode installer

You need

  • curl, usb-modeswitch, grep, awk, sudo (not necessary, last step can fail safely)
  • balong_flash in $PATH ( https://github.com/forth32/balongflash.git )
  • atinout in $PATH ( https://github.com/beralt/atinout.git will work fine )
  • 2 files we flash (core sw update version 22.x, WebUI installer), we use these (you can probably use different balong-compatible):
    • core sw: "E3372sUpdate_22.298.03.02.965.BIN" / "E3372sUpdate_22.298.03.02.965.exe"
    • webui: "Update_WEBUI_17.100.06.00.03_Hilink_V7R2_9x25_CPIO.exe"
@smarek
smarek / webvisu.py
Last active Jun 1, 2018
WebVisu automate
View webvisu.py
#!/usr/bin/python
import requests #you might need to install requests separatelly
import sys
from IPy import IP
import re
if len(sys.argv) == 1:
print "Usage: webvisu.py <target ip address> <folder with webvisu.htm and visu_ini.xml>"
sys.exit(0)