Skip to content

Instantly share code, notes, and snippets.

View alpha1125's full-sized avatar

L L alpha1125

  • Toronto, Ontario, Canada
View GitHub Profile
@alpha1125
alpha1125 / somethingController.php
Created January 3, 2021 21:42
Symfon form edit, child object, problem never passes line 32.
<?php
/**
* @Route("/{projectId<\d+>}", methods={"GET", "POST", "PUT"}, name="edit" )
* @Entity("project", expr="repository.find(projectId)")
* @Template
*
* @param string $projectId
* @param EntityManagerInterface $em
* @param Request $request
* @param ProjectHelper $projectHelper
@alpha1125
alpha1125 / scrap_emails.php
Created August 13, 2020 22:11
scrap files from a subdirectories, for emails, and echo them out as a CSV.
<?php
$folders = glob("*", GLOB_ONLYDIR);
$emailPattern = "/[A-z0-9._%+-]+@[A-z0-9.-]+\.[A-z]{2,}/";
foreach ($folders as $folder) {
$files = glob("$folder/*.html");
foreach ($files as $file) {
$contents = file_get_contents($file);
@alpha1125
alpha1125 / gist:6d84febe0d23da22cb5b17e8d09e8a9d
Created May 8, 2020 00:17
JLINK, raspbian, raspberry pi. Issue with connecting segger JLINK (clone) to proxmark 3 easy
$ sudo ./JLinkExe
SEGGER J-Link Commander V6.72b (Compiled May 4 2020 13:50:03)
DLL version V6.72b, compiled May 4 2020 13:49:44
Connecting to J-Link via USB...O.K.
Firmware: J-Link ARM V8 compiled Dec 1 2009 11:42:48
Hardware version: V8.00
S/N: -1
License(s): RDI,FlashDL,FlashBP,JFlash,GDB
VTref=3.267V
@alpha1125
alpha1125 / monitorPencilHolder.scad
Created April 16, 2020 19:20
Simple organizer to hold your pencils/pens, that hang off the back of your monitor
WallThickness=1;
A=10; // lip length
B=20; // monitor thickness
C=30; // length of pocket (inside)
D=60; // overall Width
E=70; // overall Height.
OverallWidth=B+C+(wallThickness*3);
OverallLength=D;
@alpha1125
alpha1125 / sh
Created March 24, 2020 14:01
Bash script to fetch the sha256 value from a given string.
#!/usr/bin/env bash
string="9988776: digest: sha256:994d99f0d06024acfeb99bb393dc9907d80d6bf5b49e29e313a037580f1a9b07 size: 1337"
echo "the sha is: $string" | sed 's/.*digest: sha256:\([a-f0-9]*\) size:.*/\1/'
## echo's out 994d99f0d06024acfeb99bb393dc9907d80d6bf5b49e29e313a037580f1a9b07
@alpha1125
alpha1125 / scad
Created February 9, 2020 16:32
shape profile, that I want to linear extrude and chamfer the upper and outer edges
module outerShape(){
hull(){
translate([7.5,7.5]) circle(r=7.5);
translate([7.5,55-7.5]) circle(r=7.5);
midCircle=15;
translate([45-midCircle,0]){
translate([midCircle,midCircle]) circle(r=midCircle);
translate([midCircle,55-midCircle]) circle(r=midCircle);
@alpha1125
alpha1125 / gist:42810c2433401d173227254bbfb94cbe
Created December 14, 2018 01:14
Arduino 1.8.8, https://github.com/prusa3d/Prusa-Firmware master. with two line changes. Line changes aren't the problem.
/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/lloydleung/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/lloydleung/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/lloydleung/Documents/Arduino/libraries -fqbn=rambo:avr:rambo -ide-version=10808 -build-path /var/folders/zw/919kfbjd28vb3yx642z5st6m0000gn/T/arduino_build_22011 -warnings=none -build-cache /var/folders/zw/919kfbjd28vb3yx642z5st6m0000gn/T/arduino_cache_418922 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/Applications/Arduino.app/C
--(1755:Sun,11 Nov 18:$ )-- composer -vv install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Dependency resolution completed in 0.001 seconds
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: remove symfony/symfony v3.4.18
- don't install symfony/symfony v3.4.18|remove symfony/templating v4.1.7
--(1754:Sun,11 Nov 18:$ )-- composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested PHP extension ext-http * is missing from your system. Install or enable PHP's http extension.
@alpha1125
alpha1125 / SquareCropApprovalRequiredSubscriber.php
Created December 24, 2017 17:39
Cannot get the User, from TokenStorage
<?php
namespace ContestEngineBundle\Service\EventSubscriber;
use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class SquareCropApprovalRequiredSubscriber implements EventSubscriber