Skip to content

Instantly share code, notes, and snippets.

Andrea Bergamasco vjandrea

  • freelance
  • Monaco
Block or report user

Report or block vjandrea

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vjandrea
vjandrea / cleanup.bat
Created May 20, 2019
Clean Mac folders on Windows
View cleanup.bat
@echo Removing .DS_STORE...
DEL /S ".DS_STORE"
@echo ...OK
@echo.
@echo Removing Thumbs.db...
DEL /S /AH "Thumbs.db"
@echo ...OK
@echo.
@echo Removing __MACOSX...
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d __MACOSX') do ( rd /s /q "%%i")
@vjandrea
vjandrea / charconv.py
Last active May 20, 2019
Correct the filenames of files extracted in Windows from archives compressed on Mac OS
View charconv.py
import glob
import re
import os
path = 'puntata*/**/BLOCCO*/*.mp3'
def repair_filename(filename):
repair = {
'´╝ê': '(', # U+0028 LEFT PARENTHESIS
@vjandrea
vjandrea / quote_escaping_example.lua
Last active Sep 9, 2018
LUA Quote escaping in grandma2
View quote_escaping_example.lua
--[[
I am struggling to find the best way to nest quotes while developing grandma2 plugins in LUA
This example shows the best solution i've found so far (ESCAPED SiNGLE QUOTES), but unfortunately
the command line doesn't like single quotes either. Any suggestion?
--]]
function quote_escaping_example()
gma.echo("Quote escaping example")
gma.cmd('Store Sequence 1.1 "QUOTE ESCAPING"');
@vjandrea
vjandrea / png_iconsets.py
Last active Sep 7, 2018
Generate .iconset folders from a bunch of .png files
View png_iconsets.py
import os, re, sys
# setup
path = './'
separator = '-' # this implies a filename as "iconname_somewords-16x16.png"
# runtime
current_folder = ""
files = sorted(os.listdir(path))
@vjandrea
vjandrea / quotes.json
Last active Apr 18, 2017
quotes.json for FCC Quote Machine challenge
View quotes.json
[{"text":"Don't worry about what anybody else is going to do. The best way to predict the future is to invent it.","author":"Alan Kay"},{"text":"Premature optimization is the root of all evil (or at least most of it) in programming.","author":"Donald Knuth"},{"text":"Lisp has jokingly been called \"the most intelligent way to misuse a computer\". I think that description is a great compliment because it transmits the full flavor of liberation: it has assisted a number of our most gifted fellow humans in thinking previously impossible thoughts.","author":"Edsger Dijkstra, CACM, 15:10"},{"text":"Keep away from people who try to belittle your ambitions. Small people always do that, but the really great make you feel that you, too, can become great.","author":"Mark Twain"},{"text":"What Paul does, and does very well, is to take ideas and concepts that are beautiful in the abstract, and brings them down to a real world level. That's a rare talent to find in writing these days.","author":"Jeff \"hemos\" Bates, Dire
@vjandrea
vjandrea / failing.md
Created Mar 22, 2017
Unit testing failures
View failing.md
$ codecept run unit
Codeception PHP Testing Framework v2.2.9
Powered by PHPUnit 5.7.9 by Sebastian Bergmann and contributors.

Unit Tests (976) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- FrameworksTest: Text field by label without forPHP Fatal error:  Cannot declare class Codeception\TestCase\Test, because the name is already in use in /Users/{me}/Documents/Github/Codeception/shim.php on line 18
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/codecept:0
PHP   2. require_once() /usr/local/bin/codecept:7
@vjandrea
vjandrea / failing.md
Created Mar 21, 2017
[Exception] Serialization of 'Closure' is not allowed with Codeception (REST+Laravel5 modules) testing an API
View failing.md
$ codecept run api -f -vvv
Codeception PHP Testing Framework v2.2.9
Powered by PHPUnit 5.7.17 by Sebastian Bergmann and contributors.

  Rebuilding ApiTester...

Api Tests (12)
Modules: \Helper\Api, REST, Laravel5, Asserts
@vjandrea
vjandrea / debugging.md
Last active Mar 14, 2017
Debugging asset update
View debugging.md
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Updating asset with id 101 with method PATCH  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Original asset name: "Focused tangible neural-net"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Updated asset name: "Profit-focused bifurcated capacity"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name before custom fields association: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name inside custom fields association: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name after custom fields association: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name right before saving: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Asset name right after saving: "5"  
[2017-03-14 16:19:30] local.DEBUG: [Api\AssetsController::update] Final asset name before response: "5"  
@vjandrea
vjandrea / updateAssetWithPatch.md
Created Mar 13, 2017
Failing ApiAssetsCest::updateAssetWithPatch
View updateAssetWithPatch.md
2) ApiAssetsCest: Update an asset with patch
 Test  tests/api/ApiAssetsCest.php:updateAssetWithPatch
 Step  See response contains json {"id":101,"name":"Open-architected 4thgeneration neural-net","asset_tag":"574632016","serial":"06665cae-548e-3745-91e0-fd76d30706d4","model":{"id":5,"name":"Profit-focused upward-trending complexi...}
 Fail  Response JSON does not contain the provided JSON

- Expected | + Actual
@@ @@
Array (
'id' => 101
@vjandrea
vjandrea / ApiTests error.md
Last active Mar 12, 2017
Error in every single api test
View ApiTests error.md
[Exception] Serialization of 'Closure' is not allowed

1  /vjandrea-snipe-it/vendor/laravel/framework/src/Illuminate/Session/Store.php:128
2  /vjandrea-snipe-it/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:88
3  /vjandrea-snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:216
4  /vjandrea-snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:187
5  /vjandrea-snipe-it/vendor/symfony/browser-kit/Client.php:315
6  Codeception\Module\REST->sendDELETE
7  /vjandrea-snipe-it/tests/_support/_generated/ApiTesterActions.php:360
You can’t perform that action at this time.