tag:blogger.com,1999:blog-70984812024-03-27T22:05:33.636+01:00friky.comAquí penso posar les anades de olla que em passin pel cap, no feu gaire cas. Tambe intentare posar les coses que m'agraden per si algu (no crec) té gustos semblants. Agusti 8{>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.comBlogger332125tag:blogger.com,1999:blog-7098481.post-22095879991733917802024-03-27T22:04:00.003+01:002024-03-27T22:04:38.707+01:00Lavanguardia parser, por los LOLs<p> En 30 minuts he pogut programar un petit scrapper amb python per llegir el contingut de lavanguardia sense passar pel paywall.</p><p>Of course, chatgepetto mediante.</p><p>Aquí el codi, posa qualsevol noticia i treu el text en raw, es pot millorar però vaja, ja us feu la idea.</p><p><br /></p><p><br /></p><p><br /></p>
<pre>
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from bs4 import BeautifulSoup
import time
def scrap_content(url):
# Configuración de Selenium
chrome_path = "./chromedriver" # Ruta al ejecutable de ChromeDriver
chrome_options = Options()
chrome_options.binary_location = "/usr/bin/google-chrome-stable"
chrome_options.add_argument(" --no-sandbox")
# Iniciar el navegador Chrome controlado por Selenium
service = Service(chrome_path)
driver = webdriver.Chrome(service=service, options=chrome_options)
#url = "https://www.lavanguardia.com/ciencia/20240327/9583611/neurocientificos-descifran-como-actua-psicoterapia-cerebro.html"
driver.get(url)
# Hacer scroll hasta el final de la página
last_height = driver.execute_script("return document.body.scrollHeight")
while True:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(2) # Esperar a que cargue el contenido
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == last_height:
break
last_height = new_height
# Obtener el HTML de la página después de hacer scroll
html = driver.page_source
# Cerrar el navegador controlado por Selenium
driver.quit()
# Analizar el HTML con BeautifulSoup y extraer el texto dentro de las etiquetas <div> y <span>
soup = BeautifulSoup(html, "html.parser")
content_tags = soup.find_all(lambda tag: tag.name in ['div', 'span'])
for tag in content_tags:
text = tag.get_text().strip()
if text and len(text) >= 10:
print(text)
# URL de entrada
url = input("Por favor, introduce la URL: ")
# Llamar a la función para hacer scraping
scrap_content(url)
</pre>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-43415496279217595522023-12-31T16:17:00.007+01:002023-12-31T16:17:55.697+01:00Post resum 2023<p><br /></p><p><b>Kms patinats: </b></p><p>- 612</p><p><br /></p><p><b>Gadgets of the year (comprats o regalats):</b></p><p>- iphone15 pro</p><p>- carregador inalambric iniu</p><p>- un munt de cables usb-c</p><p><br /></p><p><b>Samarretes de l’any:</b></p><p>- Easypromos</p><p>- Palorder</p><p>- Be Stack Overflow be with you</p><p>- Pixies</p><p>- Eres tan feria de Abril, Ojete Calor</p><p>- The last sofas</p><p>- Los pollos hermanos</p><p>- Heissenberg</p><p>- Morrisey is Murder</p><p>- Homer Simpson</p><p>- Where’s Jessica Hyde</p><p><br /></p><p><b>Friky coses guays:</b></p><p>- osv.dev</p><p>- lands.php.earth</p><p>- https://laraveldaily.com/roadmap-learning-path</p><p>- manticoresearch</p><p>- Muvon/yoda</p><p>- libsql/sqld</p><p>- hyperf</p><p>- SingleStore</p><p>- laravel-grapes</p><p>- Wazuh</p><p>- Elastic Security</p><p>- Laravel Pennant</p><p>- airops</p><p>- endoflife.date</p><p>- https://proxify.io/worlds/php</p><p>- crontab.guru</p><p>- saloon</p><p>- tauri.app</p><p>- PixiJS</p><p>- Edge|DB</p><p>- SurrealDB</p><p>- fixie.ai</p><p>- Ballerina</p><p>- bref.sh</p><p>- SudoLang</p><p>- suphle</p><p>- databricks dolly2</p><p>- https://developer.fermyon.com/spin/index</p><p>- https://laravel-package-ocean.com/</p><p>- phind.com</p><p>- sanity.io</p><p>- croquet.io</p><p>- https://pxplang.org/</p><p>- https://8values.github.io/quiz.html</p><p>- vector.dev</p><p>- https://python.langchain.com/en/latest/index.html</p><p>- LaraDumps</p><p>- Jolt</p><p>- coolbackgrounds.io</p><p>- Anker Solix</p><p>- sonnen batteries</p><p>- AI.jsx</p><p>- amigalive.com</p><p>- weezevent.com</p><p>- HTMX https://www.sitepoint.com/htmx-introduction/</p><p>- qwick.builder.io</p><p>- https://it-tools.tech/</p><p>- herd.laravel.com</p><p>- nativephp.com</p><p>- tldraw.com</p><p>- https://falconwatertech.com/</p><p>- idx.dev</p><p>- caddyserver.com</p><p>- nue.js</p><p>- Kamal</p><p>- signoz.io</p><p>- codewithrockstar.com</p><p>- wg/wrk</p><p>- rpgjs.dev</p><p>- appwrite.io</p><p>- https://resonance.distantmagic.com</p><p>- https://radapp.io/</p><p>- lychee.cli.rs</p><p>- turbineui.com</p><p>- vapor.codes</p><p>- frankenphp.dev</p><p>- PHP2JS</p><p>- QuickRequest</p><p>- Octoparse</p><p>- Fedora Asahi Remix</p><p>- dragonflydb.io</p><p>- idb-keyval</p><p><br /></p><p><b>Jocs als que m'he viciat aquest any:</b></p><p>- Quake 2 remastered</p><p>- Warcraft Rumble</p><p>- Suika game</p><p><br /></p><p><b>Grups guays que he descobert aquest any:</b></p><p>- Launder</p><p>- Alexanderplatz</p><p>- Muro María</p><p>- Fotos de la novia</p><p>- Bark Psychosis</p><p>- The honey buzzards</p><p>- Diavol Strain</p><p>- Minami Deutsch</p><p>- Moon Duo</p><p>- Singapore Sling</p><p>- CFM</p><p>- Acid dad</p><p>- Ringo Deathstarr</p><p>- Junip</p><p>- Sloan</p><p>- Davila 666</p><p>- The Sandwitches</p><p>- shego</p><p>- The Limiñanas</p><p>- BRONCHO</p><p>- Lucille Dupin</p><p>- Smashing Orange</p><p>- Blushing</p><p>- Píldora letal</p><p>- The Beths</p><p>- The Jaws of Brooklyn</p><p>- La Culpa</p><p>- Pencil Legs</p><p>- Dead Sullivan</p><p>- Foxes in Fiction</p><p>- Modern Baseball</p><p><br /></p><p><b>Concerts:</b></p><p>- Sr. Chinarro, sala Wolf</p><p>- Los Punsetes + Grushenka, Salamandra</p><p>- Pixies, Sant Jordi Club</p><p>- Los Toreros Muertos, Sarau</p><p>- Ojete Calor, Sant Jordi Club</p><p>- El último vecino + Fotos de la novia, Upload</p><p>- Pantocrator, Jardins de la Sedeta</p><p>- Triàngulo de amor bizarro, Apolo</p><p>- Triàngulo de amor bizarro, Zero Tarragona</p><p>- Biznaga + Los Yolos + Enemic Interior, RAZZ2</p><p><b><br /></b></p><p><b>i al Primavera:</b></p><p><br /></p><p>Dimarts:</p><p>- La Paloma + Just Mustard + Far Caspian a l’Apolo 2</p><p><br /></p><p>Dijous:</p><p>- Heather</p><p>- Terno Rei</p><p>- Alex G</p><p>- Turnstile</p><p>- OFF!</p><p>- New Order</p><p>- Le Tigre</p><p><br /></p><p>Divendres:</p><p>- Niña Coyote eta Chico Tornado</p><p>- Bala</p><p>- Los Hacheros</p><p>- The wedding present</p><p>- Depeche Mode</p><p>- Bad Religion</p><p>- Lebanon Hanover</p><p><br /></p><p>Dissabte:</p><p>- Grupo de expertos sol y nieve</p><p>- My morning jacket</p><p>- The Voidz</p><p>- The war on drugs</p><p>- Liturgy</p><p>- Maneskin</p><p><br /></p><p>I al Cruïlla, Divendres:</p><p>- Menta</p><p>- Ciudad Jara</p><p>- Sexy Zebras</p><p>- Calavento</p><p>- Pinpilimpusssies</p><p>- Carolina Durante</p><p>- Franz Ferdinand</p><p>- Sexy Zebras</p><p>- The Offspring</p><p>- Ladilla Rusa</p><p><br /></p><p><b>Pelis:</b></p><p>- Más allá de los dos minutos infinitos, filmin</p><p>- Topgun Maverick, amazon</p><p>- The Batman, HBO</p><p>- White noise, Netflix</p><p>- Willow, Disney+</p><p>- Decision to leave, cine</p><p>- Wonder Woman 1984, hbo</p><p>- Everything Everywhere At all once, cine</p><p>- John Wick 4, cine</p><p>- Dungeons and Dragons, Honor among thiefs, cine</p><p>- Evil Dead Rise, cine</p><p>- Licorice Pizza, Amazon Prime</p><p>- What lies below, Amazon Prime</p><p>- Ant-man and Wasp Quantum-mania, Disney+</p><p>- Spider-man Across the Spiderverse, cine</p><p>- Too big to fail, HBO</p><p>- Matrix resurrections, HBO</p><p>- Oppenheimer, cine</p><p>- Babylon, Amazon Prime</p><p>- Avatar, the way of water, Disney+</p><p>- Flamin Hot, la historia de los Doritos picantes, Disney+</p><p>- Broker, Filmin</p><p>- Kids, Filmin</p><p>- The Flash, HBO</p><p>- Tokyo Revengers</p><p>- Turbo Kid</p><p>- Benny loves you</p><p>- Awareness</p><p>- Jojo rabbit</p><p>- The good the bad and the weird</p><p>- Escape from Mogadicio</p><p>- Zombieland</p><p>- The first purgue</p><p>- Mad Heidi, Amazon Prime</p><p>- Otra ronda, filmin</p><p>- Venus, Amazon Prime</p><p>- Indiana Jones y el dial del destino, Disney+</p><p>- The Northman, Amazon Prime</p><p><br /></p><p><b>I a les nits de cinema de Vic:</b></p><p>- Duelo del Dragón y el Tigre (1980)</p><p>- Next Sohee</p><p>- Baby Assasins 2 - Two babies</p><p>- KBKJ</p><p>- Ninja vs Shark</p><p>- Restart the earth</p><p>- Mutant Ghost Wargirl</p><p>- The great arms robbery</p><p><br /></p><p><b>I a Sitges:</b></p><p>Dijous 5</p><p>8:30 - Tokyo Revengers 2 - Part 1 - 6.5</p><p>10:00 - Tokyo Revengers 2 - Part 2 - 6.5</p><p>12:00 - Project Silence - 7.5</p><p>14:45 - Suitable Flesh - 4</p><p>17:00 - Blackout - 2</p><p>19:15 - Let it Ghost - 6</p><p><br /></p><p>Divendres 6</p><p>8:30 - Onyx the Fortuitous and the talisman of souls - 7.5</p><p>11:00 - Last Straw - 5.5</p><p>13:15 - Los Ojos de la Noche - 7Dissabte 7</p><p>10:45 - Apéndice - 6</p><p>12:45 - Sleep - 6.5</p><p>20:00 - Propriedade - 7</p><p>22:15 - Vive Dentro - 6</p><p>Diumenge 8</p><p>8:30 - The Sacrifice Game - 7</p><p>10:30 - There’s Something in the Barn - 7.5</p><p>12:30 - Acción mutante - 7</p><p>16:00 - Brooklyn 45 - 7.5</p><p>22:00 - El Chico y la Garza - 7.5</p><p>00:45 - Wake Up - 7.5</p><p><br /></p><p>Dilluns 9</p><p>8:30 - El Exorcismo de Eastfield - 6</p><p>10:45 - You’ll Never Find Me - 7</p><p>13:00 - Robot Dreams - 5</p><p>20:00 - Diabolik - Ginko All’Attacco - 6</p><p>22:30 - Vincent Debe Morir - 8</p><p>01:00 - Late Night With the Devil - 8</p><p><br /></p><p>Dimarts 10</p><p>8:30 - Hood Witch - 7</p><p>11:30 - Sand Land - 8</p><p>13:30 - Tiger Stripes - 4.5</p><p><br /></p><p>Dimecres 11</p><p>10:45 - Nina Dei Lupi - 6</p><p><br /></p><p>Dijous 12</p><p>17:30 - The Primevals - 5</p><p>19:45 - Smugglers - 8</p><p>22:15 - Pobres Criaturas - 9.5</p><p><br /></p><p>Divendres 13</p><p>10:30 - Superposition - 5.5</p><p>12:45 - Where the Wind Blows - 3.5</p><p>15:45 - Rabia - 4</p><p>17:45 - Juego Prohibido - 5.5</p><p>20:15 - Concrete Utopia - 7.5</p><p>23:00 - Vermin: La Plaga - 7.5</p><p><br /></p><p>Dissabte 14</p><p>08:45 - Riddle of Fire - 6.5</p><p>11:15 - Sorcery - 5</p><p>13:30 - Jericho Ridge - 7.5</p><p>22:30 - Lumberjack The Monster - 6.5</p><p>01:00 - We are Zombies - 7.5</p><p><br /></p><p><b>Sitges Top 11:</b></p><p>Pobres Criaturas - 9.5</p><p>Smugglers - 8</p><p>Sand Land - 8</p><p>Vincent Debe Morir - 8</p><p>Late Night With the Devil - 8</p><p>Onyx the Fortuitous and the talisman of souls - 7.5</p><p>Project Silence - 7.5</p><p>We are Zombies - 7.5</p><p>Jericho Ridge - 7.5</p><p>Concrete Utopia - 7.5</p><p>Vermin: La Plaga - 7.5</p><p><br /></p><p><b>Sitges Bottom 11:</b></p><p>Blackout - 2</p><p>Where the Wind Blows - 3.5</p><p>Rabia - 4</p><p>Suitable Flesh - 4</p><p>Tiger Stripes - 4.5</p><p>Sorcery - 5</p><p>The Primevals - 5</p><p>Robot Dreams - 5</p><p>Juego Prohibido - 5.5</p><p>Last Straw - 5.5</p><p>Superposition - 5.5</p><p><br /></p><p><b>Series:</b></p><p>- The Crown s5, s6, netflix</p><p>- Apagón s1, movistar+</p><p>- Shadow and bone, netflix</p><p>- Esterno notte, filmin</p><p>- Three-Body, youtube</p><p>- Willow, disney+</p><p>- Northern Exposure, filmin</p><p>- The Last of Us, HBO</p><p>- The Consultant, Amazon prime</p><p>- Swarm, Amazon prime</p><p>- The office (BBC), Filmin</p><p>- Attack on Titan, s1, s2, s3, s4, special1, Amazon Prime</p><p>- Invincible, Atom Eve, Amazon Prime</p><p>- From, HBO s1, s2</p><p>- Invasion, AppleTV+ s1, s2</p><p>- Winning time, la dinastía de los Lakers, HBO, s2</p><p>- El cuerpo en llamas, Netflix</p><p>- GenV, Amazon Prime</p><p>- El peor de los males, Disney+</p><p>- Utopia (US), Amazon Prime</p><p>- El otro lado, Movistar+</p><p>- Poquita fé, Movistar+</p><p><br /></p><p><b>Llibres:</b></p><p>- The pragmatic programmer</p><p>- Boom and bust, a Global history of financial bubbles</p><p>- The Haçienda, cómo no dirigir un club, Peter Hook</p><p>- Fingers crossed, Miki Berenyi</p><p>- Macro Festivales, Nando Cruz</p><p>- La fábrica de cretinos digitales, Michael Desmurget</p><p><br /></p><p><b>Comics:</b></p><p>- El mercenario, V. Segrelles</p><p>- Querida Becky, Garth Ennis</p><p>- Crossed vol1, Garth Ennis</p><p>- Guardianes de la galaxia 3, El vórtice negro</p><p>- Ironman, demon in the bottle</p><p>- Hellboy vol1</p><p>- Crossed vol2, vol3, vol4</p><p>- Atac als titans vol1</p><p>- Molts a Marvel Unlimited</p><p><br /></p><p><b>Teatre:</b></p><p>- Las Ruinas, Blas Infante</p><p>- Berto Romero, Lo nunca visto, Coliseum</p><p>- Faemino y Cansado, 17 veces reloaded</p><p><br /></p><p><b>Documentals:</b></p><p>- Good night Oppy</p><p>- Todo y nada: Ciencia asombrosa de espacio vacío</p><p>- Arny, historia de una infámia (HBO)</p><p>- La gran distracció, TV3</p><p>- Cowspiracy</p><p>- Girl Gang: El preu de ser influencer, TV3</p><p>- Taxme if you can, filmin</p><p>- Carl Icahn, el millonario incansable, HBO</p><p>- Becoming Warren Buffet, HBO</p><p>- Icónica Chamorro, rtve play</p><p>- Eduard Punset, la urgencia del tiempo, rtve play</p><p>- La gran estafa de los teleoperadores, HBO</p><p>- Las cintas de Rosa Peral, Netflix</p><p>- El curioso caso de Natalia Grace</p><p>- Generació Porno, 3cat</p><p>- Surviving Utoya, 3cat</p><p>- La industria de lligar, 3cat</p><p>- No me llames Ternera, Netflix</p><p>- Running with the Devil: The Wild World of John McAfee, Netflix</p><p>- Fantastic Machine, Filmin</p><p>- Plastic Disasters, HBO</p><p>- Los años de la transición, HBO</p><p>- Nuñez, 3cat</p><p><br /></p><p><b>Podcasts:</b></p><p>- Nadie sabe nada</p><p>- Quieto todo el mundo</p><p><br /></p><p><b>Hotels als que he anat:</b></p><p>Cid, Sitges</p><p>Estació del Nord, Vic</p><p>Casa Boumort</p><p>Lauria, Tarragona</p><p>Ultonia, Girona</p><p><b><br /></b></p><p><b>Restaurants:</b></p><p>- Can Recasens</p><p>- San Kil</p><p>- Little Korea</p><p>- Shangai Stories</p><p>- Da Emanuele</p><p>- Dolsotbap</p><p>- La Forquilla</p><p>- Els Pescadors</p><p>- Pocha</p><p>- Os familia</p><p>- Shifu ramen</p><p>- Casa Lupe</p><p>- La barraca del Delta</p><p>- El racó del port</p><p>- Puerto Escondido</p><p>- Can Calopa</p><p>- L’Aliança d’Artés</p><p>- El Raier</p><p><br /></p><p><b>Sortides al Extranjer:</b></p><p>Desert</p><p><br /></p><p><b>Curts:</b></p><p>Desert</p><p><br /></p><p><b>Exits:</b></p><p>Desert</p><div><br /></div>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-64905436286111051752023-02-03T14:11:00.010+01:002023-02-03T14:13:07.436+01:00How to change the internal links of all the posts in wordpress<p> When you change the url pattern of a Wordpress installation some internal links can still be pointing to the old pattern of urls.</p><p>To mitigate this problem you can use a plugin like redirection in order to redirect old pattern urls to the new ones. With this solution you can solve the problem of internal links and of external links too (that you don't have control).</p><p>However, it's recommended to change all the internal links inside your content to avoid innecessary redirections.</p><p>For this reason we've created a procedure to update the content of all the posts, looking for urls that already are redirected and replacing them for the new ones.</p><p>IMPORTANT: This procedure assume that you have already installed and configured the redirection plugin and you have good knowledge of Linux commands and MySQL.</p><p><b>The procedure is as follows:</b></p><p>- Dump the wp_posts table using mysqldump</p><p>- Backup this dump just in case</p><p>- Launch a query to get all the replacement commands</p><p>- Launch replacement commands to replace all the strings in the dump</p><p>- Upload the modified dump into mysql</p><p><br /></p><div><div><b>1) Dump the wp_posts table to a file</b></div><div><br /></div><div>mysqldump -u <user> -p<password> -h <host> <db> wp_posts > wp_posts.sql</div><div><br /></div><div><b>2) Make a backup of the file, just in case..</b>.</div><div><br /></div><div>cp wp_posts.sql wp_posts.bk.sql</div><div><br /></div><div><b>3) Then launch this select using your favorite MySQL client or PHPMyAdmin.</b></div><div><br /></div><div>The idea of the sql query is to get all the redirection redirects that are enabled in the Wordpress database (table wp_redirection_items) and generate a Linux command (sed) that substitute all the urls in the content from the original ones to the new ones.</div><div><br /></div></div>
<pre>select
concat("sed -i 's/"
,replace(url,'/','\\/'),"/"
,replace(action_data,'/','\\/'),"/g' wp_posts.sql") cmd
from (
select substr(url,1,length(url)-1) url
, if(substr(action_data,length(action_data))='/', substr(action_data,1,length(action_data)-1), action_data) action_data
, action_type, status, action_code
, url original_url, action_data original_action_data
from wp_redirection_items
where url like '%/'
union all
select url
, if(substr(action_data,length(action_data))='/', substr(action_data,1,length(action_data)-1), action_data) action_data
, action_type, status, action_code
, url original_url, action_data original_action_data
from wp_redirection_items
where url not like '%/'
) t
where status='enabled'
and action_type='url'
and action_code=301
group by cmd;
</pre><pre>A sample line that are returned by the sql query above is:
sed -i 's/\/blog\/2013\/03\/prepare-your-promotions-xxx/\/blog\/prepare-your-promotions-xxx/g' wp_posts.sql
<b>4) Then execute all the lines in your Linux box it will replace all the urls that match /blog/2013/03/prepare-your-promotions-xxx by /blog\/prepare-your-promotions-xxx
because in my case I've changed the url pattern to avoid the date in the url.
</b>
Copy the results of all the lines into your Linux box in the same folder where you have generated the backup of the table wp_posts
(you must have the utility sed installed (available in 99% of Linux installations)).
<b>5) Upload the dump again</b>
mysql -u <user> -p<password> -h <host> <db> < wp_posts.sql</pre><pre>Hope this help you.</pre><pre></pre>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-44362854300646832162023-01-13T17:10:00.004+01:002023-01-13T17:10:55.547+01:00Adding percentages to labels in amcharts5<p> Amcharts5 is a very powerful graphics library, however the documentation is really scarce.</p><p><br /></p><p>If you want to add the percentage of a value in some label you must use the undocumented <b>valuePercentTotal </b>attribute in the desired text label, for example.<br /></p>
<pre><b>legendValueText: "[bold {fill}]{value} {valuePercentTotal.formatNumber('0.00p')}[/]"</b>
</pre>
Generates a label like this:<div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjRv46zoA1m7IXpHksvMWLvVnQjmRIu3VJgZiKl049csgz0xw-8iEtU5zYtbumvT6EI9W_yLw3_RAx2Z7VewUfH1FfHX4-xSqeMoDBmhvywYs-2K2ddDA9kqNs8whz0eC1ssKthcqO9PMGN6wEByjw7AeZRwYsCsIfUU-8WoZu3s2DA4n86fw" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="309" data-original-width="254" height="240" src="https://blogger.googleusercontent.com/img/a/AVvXsEjRv46zoA1m7IXpHksvMWLvVnQjmRIu3VJgZiKl049csgz0xw-8iEtU5zYtbumvT6EI9W_yLw3_RAx2Z7VewUfH1FfHX4-xSqeMoDBmhvywYs-2K2ddDA9kqNs8whz0eC1ssKthcqO9PMGN6wEByjw7AeZRwYsCsIfUU-8WoZu3s2DA4n86fw" width="197" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div>This value can be used in different labels and can be formatted as the other attributes like "value".</div><div><br /></div><div>Hope this helps</div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br />
<div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div></div>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-52773671208093038382023-01-01T11:56:00.001+01:002023-01-01T12:02:40.398+01:00Post resum 2022<p>Com cada any deixo aquí un resum del meu any 2022 sense editar molt. Un any marcat pel meu canvi de feina d'Omatech (després de gairebé 16 anys) cap a Easypromos, on em sento molt ben acollit.</p><p><b>Kilòmetres patinats:</b> 238, cal millorar!</p><p><b>Exits:</b></p><p>- Adsmurai x15</p><p><b>Gadgets of the year (comprats o regalats):</b></p><p>- LG Gram</p><p>- Airpods Pro Max</p><p>- Navalla suïssa</p><p><b>Samarretes del any:</b></p><div>DESERT</div><div><br /></div><div><div><b>Friky coses guays:</b></div><div>- n8n.io</div><div>- parceljs</div><div>- mermaid</div><div>- sidecar</div><div>- browsershot</div><div>- lando.dev</div><div>- bitsy</div><div>- Xata</div><div>- Redox</div><div>- Stackblitz</div><div>- loom</div><div>- matomo</div><div>- facebook/lexical</div><div>- redpanda</div><div>- mattermost</div><div>- loadforge</div><div>- filamentphp</div><div>- bun.sh</div><div>- zig</div><div>- orchid</div><div>- remix</div><div>- prisma.io</div><div>- sveltekit</div><div>- baserow.io</div><div>- plausible.io</div><div>- fresh.deno.dev</div><div>- railway.app</div><div>- astro</div><div>- openai and Dall-e</div><div>- simplemvc</div><div>- squirephp https://github.com/squirephp/squire</div><div>- sushi php</div><div>- https://laravel.initializer.dev/</div><div>- ponylang.io</div><div>- https://github.com/JuliaLang/julia</div><div>- VemtoApp</div><div>- jsoncrack</div><div>- qwick.builder.io</div><div>- NocoDB</div><div>- FrankenPHP</div><div>- glitch.com</div><div>- locust.io</div><div>- https://whatthediff.ai</div><div>- https://turbo.build/</div><div>- rectorphp</div><div>- twill</div><div>- bref.sh</div><div>- spiral.dev</div><div>- ulid https://github.com/ulid/spec</div><div>- Mitosis</div><div>- sulu.io</div><div>- alpine.js</div><div>- blitz.js</div><div>- synthesia</div><div>- Nanocrazor</div><div><br /></div><div><b>Jocs als que m'he viciat aquest any:</b></div><div>- PUBG New State</div><div>- Plants vs zombies 2</div><div>- Tetris99</div><div>- Katamari</div><div><br /></div><div><b>Grups guays que he descobert aquest any:</b></div><div>- Desenterradas</div><div>- Dry Cleaning</div><div>- Grasias</div><div>- Dan Romer</div><div>- Clise to Modern</div><div>- Robot Emilio</div><div>- Ovlov</div><div>- Big Thief</div><div>- Dexist</div><div>- Wet Leg</div><div>- Pillow Queens</div><div>- Nation of Language</div><div>- Yawners</div><div>- Ezekiel</div><div>- Mitski</div><div>- Just Mustard</div><div>- Portico quartet</div><div>- Lund quartet</div><div>- Whatever, Dad</div><div>- Cuchillas</div><div>- Radiator Hospital</div><div>- Secundaria</div><div>- High Vis</div><div>- Policias y Ladrones</div><div>- Videoclub</div><div>- El diablo de Shangai</div><div>- Indian Summer</div><div>- Porridge Radio</div><div>- La Paloma</div><div>- Childbirth</div><div><br /></div><div><b>Concerts als que he anat:</b></div><div>- Ojete Calor al Sant Jordi Club</div><div>- Los Punsetes + Marcelo Criminal a l’Apolo</div><div>- Just Mustard + Calibra al Sidecar</div><div>- Menta + El Diablo de Shangai a la sala VOL.</div><div>- The Cure al Palau Sant Jordi</div><div>- McEnroe + El verbo odiado a l’Apolo2</div><div><br /></div><div><b>Pelis que he vist:</b></div><div>- Spiderman no way home</div><div>- La mano de Dios</div><div>- Don’t look up</div><div>- While we’re young </div><div>- Marriage Story</div><div>- Attack the block</div><div>- Sputnik</div><div>- Ad Astra</div><div>- O que arde</div><div>- Gone Girl</div><div>- The French Dispatch</div><div>- The Adam Project</div><div>- Driven</div><div>- El método Williams</div><div>- All eyes off me</div><div>- Déjame caer</div><div>- Los Cronocrimenes</div><div>- Monster</div><div>- Lizzie</div><div>- Tourists</div><div>- Utoya</div><div>- Dr. Strange en el multiverso de la locura</div><div>- Moonfall</div><div>- Eternals</div><div>- Iron Sky</div><div>- Heat</div><div>- Peninsula</div><div>- Dredd</div><div>- Oranges Sanguines</div><div>- Apnee</div><div>- Prey</div><div>- Day shift</div><div>- To your last death</div><div>- Incendies</div><div>- El reino de la belleza</div><div>- Softie</div><div>- Yo, Cristina F</div><div>- Satan’s Slave</div><div>- Blonde</div><div>- X</div><div>- Sissy</div><div>- Deep Water</div><div>- Host</div><div>- Planeta rojo</div><div>- As Bestas</div><div>- Barbarian</div><div>- Captive State</div><div>- Troll</div><div>- Mantícora</div><div>- Your Lost Memories</div><div><br /></div><div><b>Series a les que m’he enganxat:</b></div><div>- The book of Bobba Fett</div><div>- Curb your enthusiasm s4, s5, s6, s7, s8, s9, s10, s11</div><div>- Celebrity Bake Off España</div><div>- Station Eleven</div><div>- Curb your entusiashm</div><div>- All of us are dead</div><div>- Peacemaker</div><div>- Euphoria s2</div><div>- Mai neva a ciutat s1, s2, s3</div><div>- The Dropout</div><div>- Winning time</div><div>- The Boys s3</div><div>- Locomia</div><div>- Crims s1, s2, s3</div><div>- Love, Death + Robots s1, s2</div><div>- Maricon perdido</div><div>- Stranger Things s4</div><div>- Children of Dune</div><div>- Narco Saints</div><div>- Dahmer</div><div>- La liga de los hombres extraordinarios</div><div>- Antidisturbios</div><div>- The Bear</div><div>- Autodefensa s1, s2</div><div><br /></div><div><b>Curts:</b></div><div>- Cerdita</div><div><br /></div><div><b>Llibres que he llegit:</b></div><div>- Conversaciones con Ana Curra</div><div>- Domain Driven Design in PHP</div><div>- Radical Candor</div><div>- Astrofísica para gente con prisas</div><div>- From zero to sold</div><div><br /></div><div><b>Comics:</b></div><div>- Dinastia de X / Potencias de X</div><div>- Dawn of X</div><div>- Hierba</div><div>- The Hellfire gala</div><div>- X lives of Wolverine / X deaths of Wolverine</div><div>- The trial of Magneto</div><div>- Destiny of X</div><div>- La patrulla X y los Nuevos titanes</div><div>- X-Factor</div><div>- DUNE I</div><div>- I molts més amb Marvel Unlimited</div><div><br /></div><div><b>Teatre:</b></div><div>- Faemino y Cansado. Quien tuvo, retuvo</div><div><br /></div><div><b>Documentals:</b></div><div>- Autosuficientes</div><div>- Warning: This drug may kill you</div><div>- 4 hours at the Capitol</div><div>- Devastados por el cristal</div><div>- Arcadeology</div><div>- Almost Ghosts</div><div>- Jimmy Savile, a British Horror Story</div><div>- The push</div><div>- Tell me who I am</div><div>- Natalie Wood, entre bambalinas</div><div>- Val</div><div>- Jane Fonda en cinco actos</div><div>- We were once Kids</div><div>- The John Wayne Gacy Tapes</div><div>- Los Anarquistas</div><div>- Keep sweet pray and obey</div><div>- Wall Street: David contra Goliat</div><div>- Swiped</div><div>- Orgasm Inc.</div><div>- Ummo, La España alienígena</div><div>- Entre la terra i el cel: Guerra</div><div>- Criptomonedas: guía para principiantes</div><div>- La Sagrada Família</div><div>- Osel</div><div>- Salvar al Rey</div><div><br /></div><div><b>Podcasts:</b></div><div>- itnig</div><div>- X-Rey s1, s2</div><div>- Le llamaban Padre</div><div><br /></div><div><b>Sortides al Extranjer:</b></div><div>DESERT</div><div><br /></div><div><b>Hotels als que he anat:</b></div><div>- Granados 83</div><div>- Hotel Petit Mirador</div><div>- Ultonia, Girona</div><div><br /></div><div><b>Restaurants:</b></div><div>- Ikoya</div><div>- Kanada Ya</div><div>- La Nansa, Sitges</div><div>- Els pescadors</div><div>- Lluerna, Santa Coloma</div><div>- La barraca del Delta, Amposta</div><div>- El Racó del Port, Les cases d’Alcanar</div></div><div>- Draps, Girona</div><div><br /></div><p><b>Sitges 2022:</b></p><p>38 pelis, 800kms, 16 peatges</p><p><b>Pelis vistes:</b></p><p><b>Dijous 6:</b></p><p>- Hunt</p><p>- King of screen</p><p>- The breach</p><p>- Blood flower</p><p>- Carnifex</p><p>- Deep fear</p><p><b>Divendres 7:</b></p><p>- Polaris</p><p>- After Yang</p><p>- Satan’s Slave Communion</p><p>- [REC] Terror sin pausa</p><p>- Flesheater</p><p><b>Dissabte 8:</b></p><p>- Kids vs Aliens</p><p>- Saloum</p><p>- Mal de ojo</p><p>- Flux gourmet</p><p>- The Lair</p><p><b>Diumenge 9:</b></p><p>- Tales from the Occult</p><p>- Resurrection</p><p><b>Dilluns 10:</b></p><p>- Family Dinner</p><p>- Rubikon</p><p>- Occhiali neri</p><p><b>Dimarts 11:</b></p><p>- Megalomaniac</p><p>- Slash back</p><p>- Incroyable mais vrai</p><p>- Emergency declaration</p><p>- The Knocking</p><p>- Christmas bloody Christmas</p><p><b>Dimecres 12:</b></p><p>- Shepherd</p><p>- Fumer fait tousser</p><p><b>Dijous 13:</b></p><p>- Glorious</p><p>- Social Distancing</p><p>- Pearl</p><p><b>Divendres 14:</b></p><p>- Harbinger</p><p>- Viejos</p><p><b>Dissabte 15:</b></p><p>- Wolfkin</p><p>- La exorcista</p><p>- Sisu</p><p>- Alienoid</p><p><b>Ranking millors pelis (de millor a pitjor):</b></p><p>- Sisu</p><p>- Fumer fait tousser</p><p>- Pearl</p><p>- Glorious</p><p>- Incroyable mais vrai</p><p>- Satan’s Slave Communion</p><p>- Resurrection</p><p>- Mal de ojo</p><p>- Megalomaniac</p><p>- Deep Fear</p><p>- (menció especial al documental de [REC])</p><p><b>Ranking pitjors pelis (de pitjor a… bé):</b></p><p>- Occhiali neri</p><p>- Social Distancing</p><p>- Tales from the Occult</p><p>- Carnifex</p><p>- Polaris</p><p><br /></p><p><b>Grups vistos al Primavera Sound 2022:</b></p><p><b>Dijous:</b></p><p>Aiko el grupo - 18:15 - Ouigo</p><p>Les Savy Fav - 18:55 - Binance</p><p>Richard Dawson - 19:05 - Plenitude</p><p>Dinosaur Jr. - 20:00 - Cupra</p><p>Sharon Van Etten - 21:05 - Binance</p><p>Yo la tengo - 22:20 - Cupra</p><p>Tame Impala - 22:55 - Estrella Damm</p><p>Pavement - 00:40 - Pull & Bear</p><p><br /></p><p>Divendres:</p><p>Pinpilinpussies - 16:30 - Ouigo</p><p>Cariño - 17:15 - Binance</p><p>Beach Bunny - 18:00 - Cupra</p><p>Manel - 19:00 - Pull & Bear</p><p>Fontaines DC - 20:05 - Estrella Damm</p><p>Shellac - 20:50 - Plenitude</p><p>Beck - 21:20 - Pull & Bear</p><p>Parquet Tours - 22:35 - Plenitude</p><p>Jehnny Beth - 23:30 - Ouigo</p><p><br /></p><p>Dissabte:</p><p>Die Katapult - 18:45 - Tous</p><p>Automatic - 19:55 - Ouigo</p><p>Black Country New Road - 20:40 - Binance</p><p>Nick Cave and the bad seeds - 22:00 - Pull & Bear</p><p>Bauhaus - 22:55 - Binance</p><p>Gorillaz - 00:15 - Estrella Damm</p><div><br /></div><div>Que tingueu un molt bon any 2023!</div><div>Agustí</div>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-82501842065007508102022-12-08T19:42:00.006+01:002022-12-08T19:43:13.235+01:00Query to get drop and create foreign keys pointing to a table<p>When making DB scripts that massively manipulate big tables in MySQL sometimes you want do disable all foreign keys pointing to a particular table, make some operations and then enable the foreign keys again.</p>
<p>You can query the mysql information schema to get the metainformation of the foreign keys and generate the appropiate statements.
</p><p>Just change the <b>$db-schema-name and $table-name </b>in this query and you can use the drop_cmd column that contains all the drop foreign keys statements and the create_cmd column that contains the add constraint statements to enable them again</p>
<pre>SELECT r.CONSTRAINT_SCHEMA db, r.REFERENCED_TABLE_NAME referenced_table_name
, r.CONSTRAINT_NAME, r.TABLE_NAME
, c.COLUMN_NAME, c.REFERENCED_COLUMN_NAME
, r.UPDATE_RULE, r.DELETE_RULE
, CONCAT ('alter table `',r.CONSTRAINT_SCHEMA,'`.', r.TABLE_NAME, ' drop foreign key ',r.CONSTRAINT_NAME,';') drop_cmd
, CONCAT ('alter table `',r.CONSTRAINT_SCHEMA,'`.', r.TABLE_NAME
, ' add constraint ', r.CONSTRAINT_NAME
,' foreign key (',c.COLUMN_NAME,')'
,' references ', r.REFERENCED_TABLE_NAME, '(',c.REFERENCED_COLUMN_NAME,')'
,' on delete ', r.delete_rule
,' on update ', r.update_rule
,';') create_cmd
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS r
, INFORMATION_SCHEMA.KEY_COLUMN_USAGE c
WHERE r.CONSTRAINT_SCHEMA = '$db-schema-name'
AND r.REFERENCED_TABLE_NAME = '$table-name'
AND c.REFERENCED_TABLE_SCHEMA = r.CONSTRAINT_SCHEMA
AND c.REFERENCED_TABLE_NAME = r.REFERENCED_TABLE_NAME
AND c.CONSTRAINT_NAME = r.CONSTRAINT_NAME
ORDER BY r.CONSTRAINT_NAME
</pre>
Hope this will help you!<p></p>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-20565572754054273722022-12-06T16:02:00.009+01:002022-12-06T16:56:09.770+01:00Beware of accumulating expired Octane cached itemsWhen using swoole tables as Octane cache in Laravel, be aware that the expired cached items are never really deleted. <div><br /></div><div>The get method of the cache ignores the expired items but they are never flushed if you don't explicitly delete them. </div><div><br /></div><div>To avoid the Swoole Cache table to grow ad aeternum you must do some cleanup from time to time.
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNGF3wzrTvGh75GgbIIhVUVE2Rr7h_KB4GmgneJjNwderaCXLHdMPdoAzD118hatd3ydOOs7aPi6haZrSg5rMjwGEy9pdBdeA2UwxZiWmtiSCu5aufw8Su8Pk8MSsl2uzaHlUTG82B60Ez6KTXCWsB9ucZeLlfldYBls4wEMsFltv470Fwzw/s2220/laravel-octane-featured-1617668465.png" style="display: block; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="1125" data-original-width="2220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNGF3wzrTvGh75GgbIIhVUVE2Rr7h_KB4GmgneJjNwderaCXLHdMPdoAzD118hatd3ydOOs7aPi6haZrSg5rMjwGEy9pdBdeA2UwxZiWmtiSCu5aufw8Su8Pk8MSsl2uzaHlUTG82B60Ez6KTXCWsB9ucZeLlfldYBls4wEMsFltv470Fwzw/s320/laravel-octane-featured-1617668465.png" width="320" /></a></div>
Define a new class that will do the clean up every minute using the Tick functionality of the Swoole extension. </div><div><br /></div><div><div style="background-color: black; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div style="color: white;"><span style="color: #569cd6;"><?php</span></div><span style="color: white;"><br /></span><div style="color: white;"><span style="color: #569cd6;">namespace</span> <span style="color: #4ec9b0;">xxxxxx</span>;</div><span style="color: white;"><br /></span><div style="color: white;"><span style="color: #569cd6;">use</span> Illuminate\Support\Facades\<span style="color: #4ec9b0;">Cache</span>;</div><div style="color: white;"><span style="color: #569cd6;">use</span> Illuminate\Support\Facades\<span style="color: #4ec9b0;">Log</span>;</div><div style="color: white;"><span style="color: #569cd6;">use</span> Laravel\Octane\Facades\<span style="color: #4ec9b0;">Octane</span>;</div><div style="color: white;"><span style="color: #569cd6;">use</span> Illuminate\Support\Facades\<span style="color: #4ec9b0;">App</span>;</div><span style="color: white;"><br /></span><div style="color: white;"><span style="color: #569cd6;">class</span> <span style="color: #4ec9b0;">CacheHouseKeeping</span> {</div><span style="color: white;"><br /></span><div><span style="color: white;"> </span><span style="color: #569cd6;">public</span><span style="color: white;"> </span><span style="color: #569cd6;">static</span><span style="color: white;"> </span><span style="color: #569cd6;">function</span><span style="color: white;"> </span><span style="color: #dcdcaa;">clean</span><span style="color: white;"> () {</span></div><div style="color: white;"> <span style="color: #9cdcfe;">$table</span><span style="color: #d4d4d4;">=</span><span style="color: #4ec9b0;">App</span><span style="color: #d4d4d4;">::</span><span style="color: #dcdcaa;">make</span>(<span style="color: #ce9178;">'octane.cacheTable'</span>);</div><div style="color: white;"> <span style="color: #9cdcfe;">$i</span><span style="color: #d4d4d4;">=</span><span style="color: #9cdcfe;">$deleted</span><span style="color: #d4d4d4;">=</span><span style="color: #b5cea8;">0</span>;</div><div style="color: white;"> <span style="color: #4ec9b0;">Log</span><span style="color: #d4d4d4;">::</span><span style="color: #dcdcaa;">info</span>(<span style="color: #ce9178;">"** Current date="</span><span style="color: #d4d4d4;">.</span><span style="color: #dcdcaa;">date</span>(<span style="color: #ce9178;">'Y-m-d H:i:s'</span>)<span style="color: #d4d4d4;">.</span><span style="color: #ce9178;">" expiring old cached items"</span>);</div><div style="color: white;"> <span style="color: #c586c0;">foreach</span> (<span style="color: #9cdcfe;">$table</span> <span style="color: #d4d4d4;">as</span> <span style="color: #9cdcfe;">$key</span> <span style="color: #d4d4d4;">=></span> <span style="color: #9cdcfe;">$record</span>) {</div><div style="color: white;"> <span style="color: #c586c0;">if</span> (<span style="color: #9cdcfe;">$record</span>[<span style="color: #ce9178;">'expiration'</span>]<span style="color: #d4d4d4;"><</span><span style="color: #dcdcaa;">time</span>()) {</div><div><span style="color: white;"> </span><span style="color: #4ec9b0;">Log</span><span style="color: #d4d4d4;">::</span><span style="color: #dcdcaa;">debug</span><span style="color: white;">(</span><span style="color: #ce9178;">"EXPIRING key=</span><span style="color: #9cdcfe;">$key</span><span style="color: #ce9178;"> value="</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">$record</span><span style="color: white;">[</span><span style="color: #ce9178;">'value'</span><span style="color: white;">]</span><span style="color: #d4d4d4;">.</span><span style="color: #ce9178;">' expiration='</span><span style="color: #d4d4d4;">.</span><span style="color: #dcdcaa;">date</span><span style="color: white;">(</span><span style="color: #ce9178;">'Y-m-d H:i:s'</span><span style="color: white;">, </span><span style="color: #9cdcfe;">$record</span><span style="color: white;">[</span><span style="color: #ce9178;">'expiration'</span><span style="color: white;">]));</span></div><div style="color: white;"> <span style="color: #9cdcfe;">$table</span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">del</span>(<span style="color: #9cdcfe;">$key</span>);</div><div style="color: white;"> <span style="color: #9cdcfe;">$deleted</span><span style="color: #d4d4d4;">++</span>;</div><div style="color: white;"> }</div><div style="color: white;"> <span style="color: #9cdcfe;">$i</span><span style="color: #d4d4d4;">++</span>;</div><div style="color: white;"> }</div><div style="color: white;"> <span style="color: #4ec9b0;">Log</span><span style="color: #d4d4d4;">::</span><span style="color: #dcdcaa;">info</span>(<span style="color: #ce9178;">"** Total keys scanned </span><span style="color: #9cdcfe;">$i</span><span style="color: #ce9178;">, deleted=</span><span style="color: #9cdcfe;">$deleted</span><span style="color: #ce9178;"> remaining="</span><span style="color: #d4d4d4;">.</span>(<span style="color: #9cdcfe;">$i</span><span style="color: #d4d4d4;">-</span><span style="color: #9cdcfe;">$deleted</span>)<span style="color: #d4d4d4;">.</span><span style="color: #ce9178;">" finished "</span><span style="color: #d4d4d4;">.</span><span style="color: #dcdcaa;">date</span>(<span style="color: #ce9178;">'Y-m-d H:i:s'</span>));</div><div style="color: white;"> }</div><div style="color: white;"><span style="color: #569cd6;"> </span></div><div style="color: white;"><span style="color: #569cd6;"> public</span> <span style="color: #569cd6;">static</span> <span style="color: #569cd6;">function</span> <span style="color: #dcdcaa;">boot</span>() {</div><div style="color: white;"> <span style="color: #4ec9b0;">Octane</span><span style="color: #d4d4d4;">::</span><span style="color: #dcdcaa;">tick</span>(<span style="color: #ce9178;">'cache-housekeeping-ticker'</span>, <span style="color: #569cd6;">fn</span> () => <span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">::</span><span style="color: #dcdcaa;">getAndReport</span>())</div><div><span style="color: white;"> </span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">seconds</span><span style="color: white;">(</span><span style="color: #b5cea8;">60</span><span style="color: white;">);</span></div><div style="color: white;"> }</div><div style="color: white;">}</div></div></div><div><br /></div><div><br /></div><div>And in the file <b>app/Providers/RouteServiceProvider.php </b>call the boot method of the class in order to set the Ticker. </div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><br /></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info(">... </time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><b> CacheHouseKeeping::boot();</b> </time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info(">... </time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><br /></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info(">Then, every minute the clean function will be executed and will clean all the expired items in the cache.</time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><br /></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info(">The main lines works as follows: </time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><br /></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info(">1. Get the cache Swoole table from the application service container (the App Facade).</time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><b>$table=App::make('octane.cacheTable');</b> </time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><br /></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info(">2. Loop through all the items in the swoole cache table records</time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><b>foreach ($table as $key => $record) {</b> </time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><br /></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info(">3. Check the expiration date </time></div><div><b>if ($record['expiration']<time()) {</b></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><b><time b=""><br /></time></b></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><time b="">4. Delete the expired key </time></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><b><time b=""><b>$table->del($key);</b> </time></b></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><b><time b=""><br /></time></b></time></div><div><time boot="" cachehousekeeping-ticker="" date="" deleted="$deleted" finished="" fn="" function="" h:i:s="" i="" key="$key" keys="" log::debug="" m-d="" octane::tick="" public="" remaining=".($i-$deleted)." scanned="" static="" total="" value=".$record['value'].' expiration='.date('Y-m-d H:i:s', $record['expiration']));
$table->del($key);
$deleted++;
}
$i++;
}
Log::info("><time b="">Hope this help you to keep the Octane Swoole Cache under control.
</time></time></div>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-45624828609190170012022-11-27T09:16:00.002+01:002022-11-27T09:16:30.901+01:00How to detect real client ip in swoole laravel octane without nginx but behind a reverse proxy<p> </p><p>When using Laravel Octane without nginx and you're behind a load balancer like Google Cloud Platform's or Amazon AWS or other reverse proxy that sets X-FORWARDED-FOR header, you must check this header to get the real client IP.</p><p>I've tried setting TrustedProxies etc. with no succes. And Laravel Octane didn't get it right when you call request()->ip()</p><p>Finally I've found the solution getting the server parameter HTTP_X_FORWARDED_FOR from the request and getting the first IP from a comma separated list. </p><p><br /></p><p>Check in your particular case if maybe the client IP is set in other header like HTTP_REAL_IP or similar using dd(request()->server) to get all the parameters bag.</p><p>You can use this sample class (adjust your namespace):</p><div style="background-color: black; color: white; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #569cd6;"><?php</span></div><br /><div><span style="color: #569cd6;">namespace</span> YourOrg<span style="color: #4ec9b0;">\Helpers</span>;</div><br /><div><span style="color: #569cd6;">class</span> <span style="color: #4ec9b0;">Ip</span> {</div><div> <span style="color: #569cd6;">public</span> <span style="color: #569cd6;">static</span> <span style="color: #569cd6;">function</span> <span style="color: #dcdcaa;">get</span> () {</div><div> <span style="color: #9cdcfe;">$XFFip</span><span style="color: #d4d4d4;">=</span><span style="color: #dcdcaa;">request</span>()<span style="color: #d4d4d4;">-></span><span style="color: #9cdcfe;">server</span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">get</span>(<span style="color: #ce9178;">'HTTP_X_FORWARDED_FOR'</span>);</div><div> <span style="color: #c586c0;">if</span> (<span style="color: #9cdcfe;">$XFFip</span>) {</div><div> <span style="color: #9cdcfe;">$ips</span> <span style="color: #d4d4d4;">=</span> <span style="color: #dcdcaa;">explode</span>(<span style="color: #ce9178;">','</span>, <span style="color: #9cdcfe;">$XFFip</span>);</div><div> <span style="color: #9cdcfe;">$ips</span> <span style="color: #d4d4d4;">=</span> <span style="color: #dcdcaa;">array_map</span>(<span style="color: #ce9178;">'trim'</span>, <span style="color: #9cdcfe;">$ips</span>);</div><div> <span style="color: #9cdcfe;">$ip</span> <span style="color: #d4d4d4;">=</span> <span style="color: #9cdcfe;">$ips</span>[<span style="color: #b5cea8;">0</span>]; </div><div> } <span style="color: #c586c0;">else</span> {</div><div> <span style="color: #9cdcfe;">$ip</span><span style="color: #d4d4d4;">=</span><span style="color: #dcdcaa;">request</span>()<span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">ip</span>();</div><div> }</div><div> <span style="color: #c586c0;">return</span> <span style="color: #9cdcfe;">$ip</span>;</div><div> }</div><div>}</div></div><p><br /></p><p>Then anywhere in your code you can use:</p><div style="background-color: black; color: white; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div style="line-height: 19px;"><span style="color: #569cd6;">use</span> YourOrg\Helpers\<span style="color: #4ec9b0;">Ip</span>;</div><div style="line-height: 19px;"><br /></div><div style="line-height: 19px;">...</div></div><div style="background-color: black; color: white; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><span style="color: #4ec9b0;"><br /></span></div><div style="background-color: black; color: white; font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><span style="color: #4ec9b0;">echo Ip</span><span style="color: #d4d4d4;">::</span><span style="color: #dcdcaa;">get</span>();</div><p><br /></p><p>Have fun</p><p><br /></p>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-72338715853645372562022-01-01T21:19:00.006+01:002023-01-01T12:01:11.450+01:00Post resum 2021<p><b>Gadgets of the year (comprats o regalats):</b></p><p>desert</p><p><b>Kilòmetres patinats:</b> 930</p><p><b>Samarretes del any:</b></p><p>sadako gameboy</p><p>sushi kill bill</p><p>starters friends</p><p>scarlet witch, no more mornings</p><p><br /></p><p><b>Friky coses guays:</b></p><p>craftcms</p><p>workerman</p><p>newman</p><p>wrk</p><p>swoole</p><p>roadrunner</p><p>meilisearch</p><p>rasa</p><p>krakend.io (lura)</p><p>Utopia</p><p>phpinsights v2</p><p>hotwire turbo</p><p>phpsandbox.io</p><p>getporter.dev</p><p>neatnik.net/view-source</p><p>SvelteKit</p><p>Frontity</p><p>https://laravel-news.com/rich-text-for-laravel</p><p>pixijs.io</p><p>Astro</p><p>solid.js</p><p>asyncapi</p><p>monaco-editor</p><p>gather.town</p><p>api platform</p><p>react-admin</p><p>lean-admin.dev</p><p>builderio/qwik</p><p>builderio/partytown</p><p>lighthouse-php</p><p>locust.io</p><p><br /></p><p><b>Jocs als que m'he viciat aquest any:</b></p><p>Sparkle 2</p><p>Puyo puyo tetris</p><p>PUBG New State</p><p><br /></p><p><b>Grups guays que he descobert aquest any:</b></p><p>Alcest</p><p>Pantocrator</p><p>Melenas</p><p>Martes Niebla</p><p>Marta Movidas</p><p>Nueve desconocidos</p><p>Patio Rosemary</p><p>The Goon Sax</p><p>L.A. Exes</p><p>Menta</p><p>Margaritas podridas</p><p>Disco Las Palmeras!</p><p>Maw</p><p>Beladrone</p><p>Airiel</p><p>shane</p><p>Dharmacide</p><p>Cruz de Navajas</p><p>Ciudad lineal</p><p>Depresión sonora</p><p>Último día</p><p>Plataforma</p><p>Chill Mafia Records</p><p>Sofia</p><p>Luz Futuro</p><p>Mausoleo</p><p>Somos la herencia</p><p>Cruhda</p><p>Nunca Nada</p><p>VVV</p><p>Margarita quebeada</p><p>Viuda</p><p>Paralelo</p><p>El destello</p><p>Quiets</p><p>Galería interior</p><p><br /></p><p><b>Concerts als que he anat:</b></p><p>desert</p><p><br /></p><p><b>Pelis que he vist:</b></p><p>La autopsia de Jane Doe</p><p>Hellboy (2019)</p><p>JT Leroy: Engañando a Hollywood</p><p>Mank</p><p>Primos</p><p>Widows</p><p>Wonder Woman</p><p>The Big Short</p><p>El escándalo</p><p>Deadpool 2</p><p>Odio por Dani Rovira</p><p>The assistant</p><p>Las ventajas de ser un marginado</p><p>Cherry</p><p>Space Sweepers</p><p>Zach Snyder’s Justice League</p><p>Capa caída</p><p>Josep</p><p>Die Hard 4.0</p><p>Hangover</p><p>Hangover 2</p><p>Hangover 3</p><p>Robocop 2014</p><p>Spiderman far from home</p><p>Lego Movie 2</p><p>Los juicios de Nuremberg</p><p>Don Jon</p><p>The Circle</p><p>Army of dead</p><p>Sucker Punch</p><p>Shiva baby</p><p>Mitchells vs the machines</p><p>Jay and Silent Bob: The reboot</p><p>Midsommar</p><p>The night eats the world</p><p>The eight night</p><p>War of tomorrow</p><p>Terminator: Genisys</p><p>Man on the moon</p><p>A quiet place</p><p>Heavy Metal</p><p>It follows</p><p>Reindeerspoting</p><p>The lost boys</p><p>1987</p><p>John Wick 3, Parabellum</p><p>Night in Paradise</p><p>El padrino</p><p>El padrino 2</p><p>Cruella DeVil</p><p>El padrino 3</p><p>Dune</p><p>Wyrmwood</p><p>The last of wolves</p><p>Ali G indahouse</p><p>Destello bravio</p><p>Tesla</p><p>Crash</p><p>Sound of violence</p><p>The thing</p><p>The lighthouse</p><p>Veteran</p><p>Kenshin</p><p>My hero academia, hero’s world mission</p><p>Dolores. La verdad sobre el caso Wanninkhof</p><p>Greetings from Tromaville</p><p>Zombies en el cañaveral</p><p>Holiday</p><p>Red State</p><p>Bohemian Rapshody</p><p>Joker</p><p>Green room</p><p>Freud: The secret passion</p><p>The Show</p><p>Atrapado en el túnel</p><p>Free guy</p><p>Frances Ha</p><p>Venom</p><p>A scanner darkly</p><p>Black Widow</p><p>Ron da error</p><p><br /></p><p><b>Pelis vistes a Sitges:</b></p><p>Hunter Hunter</p><p>Alien on stage</p><p>Caveat</p><p>Werewolves wihin</p><p>La Pasajera</p><p>Witch hunt</p><p>Censor</p><p>Le calendrier</p><p>Mona Lisa and the blood moon</p><p>Wyrmwood apocalypse</p><p>Broadcasting signal intrussion</p><p>Realidad virtual</p><p>Cliff Walkers</p><p>The amusement park</p><p>The deep house</p><p>The Sadness</p><p>The boy behind the door</p><p>Llanto Maldito</p><p>The trip</p><p>The knocking</p><p>Lamb</p><p>in the earth</p><p>the exorcism of god</p><p>Superhost</p><p>The power</p><p>El páramo</p><p>Hand rolled cigarrete</p><p>Limbo</p><p>Barbarians</p><p>Antlers</p><p>Eight for silver</p><p>The medium</p><p>The Samejima incident</p><p>She will</p><p>Nitram</p><p>Demonic</p><p>Last night in soho</p><p>The great yokai wars, Guardians</p><p>Son</p><p>Tides</p><p>Dashcam</p><p><br /></p><p><b>Top 5 i bottom 5 Sitges:</b></p><p><br /></p><p><b>Top 10 (de millor a pitjor):</b></p><p>The Sadness</p><p>Last night in soho</p><p>Dashcam</p><p>Alien on stage</p><p>Censor</p><p>The trip</p><p>Limbo</p><p>Lamb</p><p>Son</p><p>The deep house</p><p><br /></p><p><b>Bottom 5 (de millor a pitjor):</b></p><p>Caveat</p><p>Broadcasting signal intrussion</p><p>The boy behind the door</p><p>Llanto Maldito</p><p>The knocking</p><p><br /></p><p><b>Curts:</b></p><p>desert</p><p><br /></p><p><b>Llibres que he llegit:</b></p><p>The mythical man-month</p><p>Object Oriented Programming, Timothy Budd</p><p>Clean Code, Robert C. Martin</p><p>It doesn’t have to be crazy at work, Jason Fried, David Heinemeier</p><p>Ready player two, Ernest Cline</p><p>Dune (rellegit)</p><p><br /></p><p><b>Comics:</b></p><p>molts, he perdut el compte</p><p><br /></p><p><b>Series a les que m'he enganxat (sense ordre particular):</b></p><p>La casa de papel s1,s2,s3,s4,s5</p><p>Squid game</p><p>The Soprano s1-s6</p><p>Seinfield s1-s9</p><p>Sweet Home</p><p>The morning show s1</p><p>Unorthodox</p><p>High Score</p><p>Servant s1,s2</p><p>It’s a sin</p><p>Wandavision</p><p>The Boys s2</p><p>Raised by wolves</p><p>Calls</p><p>Snowpiercer s2</p><p>Invincible</p><p>Mrs. Fletcher</p><p>The Crown s4</p><p>Ted Lasso</p><p>The royal house of windsor</p><p>Falcon and the winter Soldier</p><p>Snabba Cash</p><p>Queen’s Gambit</p><p>Jupiter’s Legacy</p><p>El vecino s1, s2</p><p>Loki</p><p>Sweet Tooth</p><p>Inside Job</p><p>The billion dollar code</p><p>Borat’s American Lockdown</p><p>Black Summer s1,s2</p><p>Todo lo otro s1</p><p>black Mirror s1,s2,s3</p><p>Station Eleven</p><p>The Silent sea</p><p>Hellbound</p><p>Hawkeye</p><p>Curb your enthusiasm s1,s2,s3</p><p><br /></p><p><b>Teatre:</b></p><p>Faemino y Cansado. Quien tuvo, retuvo</p><p><br /></p><p><b>Documentals:</b></p><p>High Score</p><p>El Pepe a supreme life</p><p>Brexit at closed doors</p><p>Pobreza en Estados Unidos</p><p>Power of Grayskull</p><p>Allen vs. Farrow</p><p>Billie Eilish, the world is little blurry</p><p>Wrinkles the clown</p><p>El Víbora, Solo para supervivientes</p><p>El Terrat, los primeros 30</p><p>Lolo Rico, la mirada no inventada</p><p>The Reagan show</p><p>El culo del mundo</p><p>Friends: The reunion</p><p>Barça Dreams</p><p>Dirty Money s1, s2</p><p>Becoming Warren Buffet</p><p>Heroin, Cape Cod, USA</p><p>Spielberg</p><p>Q into the storm</p><p>La Familia</p><p>Lo and behold: el inicio de Internet</p><p>Los bots del dinero</p><p>El arma perfecta</p><p>Galácticos</p><p>El chico más bello del mundo</p><p>Jodorosky’s dune</p><p>La dura cerdad sobre la dictadura de Franco</p><p>El fin de ETA</p><p>Story of plastic</p><p>Cryptopia: Bitcoin, Blockchains and the future of the Internet</p><p>San Julian: el poder de la ilustración</p><p>What happenes to Brittany Murphy?</p><p>Springboard</p><p>NYC Epicenters 9/11 -> 2021</p><p><br /></p><p><b>Sortides al Extranjer:</b></p><p>desert</p><p><br /></p><p><b>Millors Hotels als que he anat:</b></p><p>Hostal Sa Tuna</p><p><br /></p><p><b>Millors restaurants:</b></p><p>Yatai</p><p>La forquilla (2)</p><p>Dolsotbap</p><p>Devil’s Kitchen</p><p>Hostal Sa Tuna</p><div><br /></div>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-42565139866946403252021-02-12T15:12:00.006+01:002021-02-12T15:23:20.915+01:00The ultimate purge logs bash script for Laravel<p>Let's assume that you have a very large log table that can grow up to millions of records.</p><p> In this example the table is named activity_logs and VERY IMPORTANT it should have an index in created_at to allow us to remove records by date.</p><p>If you put this shell script in the root folder of your Laravel project it will take the database credentials from your .env file and purgue the log table day by day, from an starting date to an end date (in the example from 6 months ago to 2 months ago) <br /></p><p>#### Contents of purge_logs.sh<br /></p><p>dbhost=$(grep -oP '^DB_HOST=\K.*' .env)<br />dbpass=$(grep -oP '^DB_PASSWORD=\K.*' .env)<br />dbname=$(grep -oP '^DB_DATABASE=\K.*' .env)<br />dbusername=$(grep -oP '^DB_USERNAME=\K.*' .env)<br /><br />i=$(date --date="6 months ago" +"%Y-%m-%d")<br />limit=$(date --date="2 months ago" +"%Y-%m-%d")<br />while [ "$i" != "$limit" ]; do<br /> echo $i limit $limit<br /> tomorrow=$(date -I -d "$i + 1 day")<br /><br /> mysql -u $dbusername -p$dbpass -h $dbhost --default-character-set=utf8 $dbname << EOF<br />delete from activity_logs<br />where<br />created_at>='$i'<br />and created_at<'$tomorrow'<br />EOF<br /><br /> sleep 5<br /> i=$tomorrow<br />done</p><p>#### end of purge_logs.sh<br /></p><p><b>Explanation</b></p><p>Those lines take the db parameters from the .env file and make them available to the script. <br /></p><p>dbhost=$(grep -oP '^DB_HOST=\K.*' .env)<br />dbpass=$(grep -oP '^DB_PASSWORD=\K.*' .env)<br />dbname=$(grep -oP '^DB_DATABASE=\K.*' .env)<br />dbusername=$(grep -oP '^DB_USERNAME=\K.*' .env)</p><p>Then configure the starting date and the limit</p><p>i=$(date --date="6 months ago" +"%Y-%m-%d")<br />limit=$(date --date="2 months ago" +"%Y-%m-%d")</p><p>You can change the parameters as long as they are valid date params, for example you can use "today", "tomorrow", "2 weeks ago", ... </p><p>In the next two lines we'll start the loop and echo the dates for debug purposes, and guess the next day in the variable "tomorrow", beware, the limit should be greater than the start date, if you don't want an infinite loop :) <br /></p>while [ "$i" != "$limit" ]; do<br /> echo $i limit $limit<br /> tomorrow=$(date -I -d "$i + 1 day")<br /><p> Then launch mysql with the script to delete the records between $i and $tomorrow</p><p> mysql -u $dbusername -p$dbpass -h $dbhost --default-character-set=utf8 $dbname << EOF<br />delete from activity_logs<br />where<br />created_at>='$i'<br />and created_at<'$tomorrow'<br />EOF</p><p> In the last lines we'll sleep for a while to avoid stressing our server and recalculate the $i date</p><p> sleep 5<br /> i=$tomorrow<br />done</p><p>Finally you can add a line in your crontab to run the script once a day for example:<br /></p><p>10 0 * * * cd root_folder; ./purge_logs.sh <br /></p><p>Hope this help <br /></p><p> </p>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-50066424790114550012021-01-01T10:17:00.004+01:002021-01-01T10:17:17.740+01:00Post resum 2020<p><b>Gadgets of the year (comprats o regalats):</b><br />Cap</p><p><b>Samarretes del any:</b><br />Ink Snorlax<br />Dark Star Summer Camp<br />LeChuck Grog<br />Offline Park<br />2020 bad review<br />psycho star wars<br />raise spirits up<br />I don’t always test my code but when I do, I do it in production<br />I am an engineer to save time, just assume I’m aleays right<br /><br /><br /><b>Friky coses guays:</b><br />Stimulus<br />Sails.js<br />nedb<br />Redox<br />Tactician<br />inertia.js<br />svelte.dev<br />structurizr.com<br />strapi.io<br />dgraph.io<br />deno.land<br />https://www.biotech-foods.com<br />beekeeperstudio.io<br /><br /><br /><b>Jocs als que m'he viciat aquest any:</b><br />Fallout Shellter<br />PUBG mobile<br />COD mobile<br /><br /><b>Grups guays que he descobert aquest any:</b><br />Bigott<br />Lisasinson<br />Crushed Beacks<br />Pet Shimmers<br />Alvvays<br />Comando Suzie<br />Soviet Soviet<br />Anabel lee<br />Topographies<br />Automatic<br />Chelsea Wolfe<br />Somos la herencia<br />Ambros Chapel<br />Luna y panorama de los insectos<br />Marcelo Criminal<br />Ela Minus<br />Décima víctima<br /><br /><b>Concerts als que he anat:</b><br />RIDE + Crushed Beaks<br />Sandy (Alex G) + Pet shimmers<br /><br /><b>Pelis que he vist:</b><br />Girl<br />The drug king<br />I’m not a serial killer<br />Toy Story 4<br />Captain Marvel<br />Thor el reino oscuro<br />Thor Ragnarok<br />Guardians of the galaxy<br />Guardians of the galaxy vol 2<br />Ant-man<br />Captain America winter soldier<br />Captain America Civil War<br />Time to hunt<br />Avengers Age of Ultron<br />Dr. Strange<br />Avengers Infinity War<br />Guns Akimbo<br />Grabbers<br />I love you, stupid<br />Rampant<br />The Clobberfield Paradox<br />Da 5 Bloods<br />Dolor y gloria<br />Velvet buzzsaw<br />Shin Godzilla<br />You were never really here<br />Mortal engines<br />Canino<br />The rules of attraction<br />Jupiter’s moon<br />1984<br />Greyhound<br />The old guard<br />Snowpiercer<br />Tiempo después<br />1917<br />System error<br />Extraterrestre<br />Outbreak<br />American Pickle<br />Illang la brigada del lobo<br />The wandering earth<br />#Alive<br />Aquaman<br />Take shelter<br />Showgirls<br />Borat 2<br />The Purge: Anarchy<br />Padre no hay más que uno<br />La caída del imperio Americano<br />La edad de la ignorancia<br />Please stand by<br />De Pollos y hombres<br />Old boy<br />On the rocks<br />Blade runner 2049<br />Dans la brume<br />Under the skin<br /><br /><b>Pelis vistes a Sitges</b>:<br />The night<br />Vicious fun<br />La funeraria<br />Blackwater: Abyss<br />The pale door<br />Archenemy<br />Kubrick by Kubrick<br />Bumperkleef<br />Malnazidos<br />Lucky<br />Spirit walk<br />La vampira de Barcelona<br />Mandibules<br />The queen of black magic<br />Boys from country hell<br />No matarás<br />The old ways<br />Mosquito state<br />May the devil take you 2<br />She dies tomorrow<br />Tin Can<br />A perfect enemy<br />Le Nuee<br />Soul<br />Ghost in the shell<br />Snowden<br /><br /><b>Top 5 i bottom 5 Sitges:</b><br /><br /><b>Top 5 (de millor a pitjor):</b><br />Mandibules<br />Bumperkleef<br />Le Nuee<br />The queen of black magic<br />A perfect enemy<br /><br /><b>Bottom 5 (de millor a pitjor):</b><br />She dies tomorrow<br />Lucky<br />The pale door<br />La funeraria<br />Tin Can<br /><br /><b>Curts:</b><br />Cap<br /><br /><b>Llibres que he llegit:</b><br />Open, Andre Agassi<br />Sapiens<br />Historias de terror, Liz Phair<br />El consentimiento, Vanessa Sprinzora<br /><br /><b>Comics:</b><br />The Boys, tomos 1,2,3<br />Guardians of the galaxy vol1, vol2<br />Raven<br />Snowpiercer<br />X-Men la saga Messiah Complex</p><p><br /><b>Series a les que m'he enganxat (per ordre d'adiccio):</b><br />Dracula<br />Watchmen<br />Star Trek TNG s5,s6,s7<br />Picard<br />Kingdom s2<br />The Mandalorian<br />Upload<br />The Last Dance<br />La conjura contra America<br />Silicon Valley s6<br />See<br />The Purge s1, s2<br />Snowpiercer<br />Community<br />Dietland<br />Utopia s1, s2<br />El colapso<br />Watchmen<br />El fin de la comedia<br />Seinfeld<br />Little Britain USA<br />Norsemen s1, s2<br />Pure<br />Dragonslayer666<br />Días de mierda<br />Patria<br />Utopia 2020 us<br />Star Trek Discovery s3<br />Euphoria<br />Parlement<br />The Terror s1<br />30 monedas<br /><br /><b>Teatre:</b><br />Berto, cuanta tontería<br /><br /><b>Documentals:</b><br />McMillions<br />One child nation<br />Jeffrey Epstein: Filthy rich<br />Polansky, se busca<br />Garbo, the spy<br />Catalunya Barcelona: La historia catalana de Barcelona<br />Deep water<br />Eugenio<br />Sesión Salvaje<br />El Palmar de Troya<br />You don’t Nomi<br />The forum<br />Too funny to fail<br />El desafio ETA<br />Banksters<br />Oeconomia<br />James May, our man in Japan<br />This giant beast that is global economy <br /><br /><b>Sortides al Extranjer:</b></p><p>Cap<b> </b><br /><br /><b>Millors Hotels als que he anat:</b><br />Sa Tuna<br /><br /><b>Millors restaurants:</b><br />Gorria (2)<br />Xerta<br />Lluerna<br />Ferran Cerro<br />Direkte<br /><br /></p>Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com1tag:blogger.com,1999:blog-7098481.post-10791629975908902362020-01-05T17:15:00.001+01:002020-01-05T17:15:14.153+01:00Post resum 2019Exits:<br />
omatech (parcial)<br />
<br />
Gadgets of the year (comprats o regalats):<br />
tado, smart air conditioning remote controller<br />
Activ5<br />
AirpodsPro<br />
<br />
Samarretes del any:<br />
Harry Pawter<br />
Arrakis Surf<br />
The Masters<br />
<br />
<br />
Friky coses guays:<br />
Cypress.io<br />
omatech/laravel-imaginator<br />
omatech/mage<br />
editorjs.io<br />
loom<br />
flourish.studio<br />
inertia.js<br />
handsome tables<br />
activ5<br />
lucid architecture<br />
apache kafka streams<br />
quasar framework<br />
debezium.io<br />
openfaas<br />
kubeless<br />
Livewire<br />
outklip.com<br />
loadimpact.com<br />
reqtest.com<br />
phpspy<br />
trix<br />
<br />
Jocs als que m'he viciat aquest any:<br />
Have Ho<br />
<br />
Grups guays que he descobert aquest any:<br />
Juanita y los feos<br />
Cosmo K<br />
Pablo prisma y las Piramides<br />
La Plata<br />
Axolotes Mexicanos<br />
Las ligas menores<br />
Confeti de Odio<br />
Autoescuela<br />
Rata negra<br />
Joan as police woman<br />
Schwervon!<br />
American Football<br />
Pantones<br />
Sierra<br />
Anari<br />
Turquoise Days<br />
Soccer Mommy<br />
Siete70<br />
Putilatex<br />
Stephen Malkmus and the Jicks<br />
Rojuu<br />
Futuro terror<br />
She passed away<br />
Lebanon Hanover<br />
Hawaiian Gremlins<br />
Apartamentos Acapulco<br />
<br />
Millors concerts als que he anat:<br />
Petroleo al RAZZ<br />
Yo la tengo al Apolo<br />
Florence and the machine al Palau Sant Jordi<br />
Ojete calor al RAZZ<br />
Primavera sound 2019<br />
Los Punsetes al RAZZ<br />
Pixies al Sant Jordi Club<br />
<br />
Millors pelis que he vist:<br />
La pianiste<br />
Bird box<br />
Spiderman nuevo universo<br />
The favourite<br />
One cut of the dead<br />
Blackkklansman<br />
The dead don’t die<br />
Brexit<br />
Once upon a time in Hollywood<br />
Train to Busan<br />
Terminator: Genesis<br />
Passengers<br />
Farenheit 451<br />
Scape from New York<br />
Scape from LA<br />
The offspring<br />
The woman<br />
Darkest hour<br />
Parasite<br />
The founder<br />
Star wars the rise of Skywalker<br />
<br />
Altres pelis que he vist:<br />
Roma<br />
Detective Pikachu<br />
Demon hunter Nezha<br />
<br />
Pelis vistes a Sitges:<br />
Code8<br />
One piece Stampede<br />
Bodies at rest<br />
Ready or not<br />
Little monsters<br />
Dark encounter<br />
Ventajas de viajar en tren<br />
Antrum<br />
The room<br />
The deeper you dig<br />
Vivarium<br />
The Nest<br />
Judy and punch<br />
L’Angle mort<br />
Snatchers<br />
Body at Brighton rock<br />
Amigo<br />
Daniel isn’t real<br />
Misterio de la noche<br />
Corporate animals<br />
I trapped the devil<br />
Super me<br />
The mute<br />
El hoyo<br />
After midnight<br />
J’ai perdu mon corps<br />
Come to daddy<br />
Girl on the third floor<br />
The gangster, the cop and the devil<br />
synchronic<br />
Depraved<br />
Swallow<br />
The cleansing hour<br />
Extra ordinary<br />
Le Daim<br />
Yves<br />
Dawn<br />
Sadako<br />
The wild goose lake<br />
Colour out of space<br />
Hail Satan?<br />
Memory, The origins of Alien<br />
<br />
<br />
Top 10 i bottom 10 Sitges:<br />
<br />
Top 10:<br />
1. Ventajas de viajar en tren<br />
2. El hoyo<br />
3. Amigo<br />
4. Swallow<br />
5. Extra ordinary<br />
6. Little monsters<br />
7. Snatchers<br />
8. Ready or not<br />
9. The cleansing hour<br />
10. Colour out of space<br />
<br />
Bottom 10 (de mejor a peor):<br />
10. Girl on the third floor<br />
9. Bodies at rest<br />
8. Body at Brighton Rock<br />
7. Sadako<br />
6. Dark encounter<br />
5. Depraved<br />
4. L'Angle mort<br />
3. I trapped the devil<br />
2. Misterio de la noche<br />
1. Antrum<br />
<br />
Curts:<br />
Get your brain back<br />
Limbo<br />
Experimentos para transformar la fe en energia<br />
Maw<br />
Things Were<br />
Better Before<br />
Imaginario<br />
Coda Sacra<br />
Bath Bomb<br />
I’m the doorway<br />
Five course meal<br />
<br />
<br />
Llibres que he llegit i m'han agradat:<br />
El bosque oscuro<br />
El fin de la muerte<br />
Pensar rápido, pensar despacio<br />
How to win friends and influence people<br />
Hola mundo<br />
<br />
Comics:<br />
La muerte de Lobezno<br />
Mandela y el general<br />
<br />
<br />
Series a les que m'he enganxat (per ordre d'adiccio):<br />
The boys s1<br />
Star trek discovery s2<br />
Flea Bag s2<br />
Years and years<br />
Kingdom s1<br />
Game of thrones s8<br />
Stranger things s3<br />
The Witcher s1<br />
Mind Hunters s2<br />
Chernobil s1<br />
Big little lies s1, s2, s3<br />
Peaky Blinders s5<br />
The crown s1, s2, s3<br />
Star Trek TNG s1 s2 s3 s4<br />
Silicon Valley s4,s5<br />
The deuce s2<br />
Love s1 s2<br />
El Pionero<br />
The alienist s1<br />
Mira lo que has hecho s1 s2<br />
Electric Dreams s1<br />
Mars s1<br />
El caso Alcasser<br />
Another life s1<br />
The umbrella academy s1<br />
<br />
Teatre:<br />
El Dolor, Marguerite Duras al TNC<br />
<br />
Documentals:<br />
Desenterrando Sad Hill<br />
La guerra del wolframio<br />
Las dos catalunyas<br />
Jane Fonda in 5 acts<br />
Generation wealth<br />
Leaving Neverland<br />
Global Junk Food<br />
The Creepy Line<br />
Wild Wild Country<br />
The inventor: Out for blood in Silicon Valley<br />
The Big Hack<br />
En la mente de Robin Williams<br />
HAK_MTL<br />
Kurt and Courtney<br />
ww2 in color<br />
<br />
Sortides al Extranjer:<br />
Madrid<br />
<br />
Millors Hotels als que he anat:<br />
Double tree by Hilton, Girona<br />
<br />
Millors restaurants:<br />
Celler de can Roca<br />
Massana<br />
Hofmann<br />
Gorria<br />
Minyam<br />
Echegaray<br />
Dos palillos<br />
Els pescadors<br />
<div>
<br /></div>
Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-19966748843379868612019-12-17T14:07:00.001+01:002019-12-17T14:11:13.501+01:00Collatz Conjeture in PHPI've made some versions of the Collatz Conjeture in PHP, this is the most simple, it didn't use any array storage to avoid filling the computer memory.<br />
<br />
It takes 163 seconds in my MacBook to test first 10.000.000 integers.<br />
<br />
Sample output (after 163 seconds):<br />
ENDED CHECKING UNTIL 10000000 in 163 seconds (61349.693251534 numbers per second)<br />
<br />
<br />
$limit=10000000;<br />
$i=2;<br />
$checked=array();<br />
$start=time();<br />
<br />
while ($i<=$limit)<br />
{<br />
//echo "$i : ";<br />
if (!collatz($i))<br />
{<br />
echo "$i NO!\n";<br />
die;<br />
} <br />
$i++;<br />
}<br />
echo "\n";<br />
<br />
$end=time();<br />
$elapsed=$end-$start;<br />
$numbers_per_second=$limit;<br />
if ($elapsed>0) $numbers_per_second=$limit/$elapsed;<br />
<br />
echo "ENDED CHECKING UNTIL $limit in $elapsed seconds ($numbers_per_second numbers per second)\n";<br />
<br />
function collatz ($i)<br />
{<br />
if ($i==1) return true;<br />
<br />
//echo "$i,";<br />
if ($i%2==0)<br />
{// par<br />
$i=collatz($i/2);<br />
}<br />
else<br />
{// impar<br />
$i=collatz(($i*3)+1);<br />
}<br />
return $i;<br />
}<br />
<div>
<br /></div>
Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-84709172777119637602019-12-17T14:04:00.001+01:002019-12-17T14:09:20.094+01:00Collatz Conjeture in RustAs a test of Rust language I've done a simple Rust checker from 1 to 10.000.000 it takes 18 seconds in my MacBook.<br />
<br />
Sample output (after 18 seconds):<br />
10000000 numbers checked in 18 seconds (555555 numbers per second)<br />
<br />
use std::process::exit;<br />
use std::time::Instant;<br />
<br />
fn main() {<br />
let mut i=1;<br />
let start = Instant::now();<br />
<br />
while i<=10000000<br />
{<br />
let res=collatz(i);<br />
if res<br />
{<br />
i=i+1;<br />
}<br />
else<br />
{<br />
println!("{} NO!!!", i);<br />
exit(1);<br />
}<br />
}<br />
let elapsed=start.elapsed().as_secs();<br />
println!("{} numbers checked in {} seconds ({} numbers per second)", i-1, elapsed, (i-1)/elapsed);<br />
}<br />
<br />
fn collatz(i: u64) -> bool<br />
{<br />
let mut res;<br />
res=false;<br />
<br />
if i==1<br />
{<br />
res=true<br />
}<br />
else<br />
{<br />
if i%2==0<br />
{// par<br />
res=collatz(i/2);<br />
}<br />
else<br />
{// impar<br />
res=collatz((i*3)+1);<br />
}<br />
}<br />
res<br />
}<br />
<div>
<br /></div>
Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-86035708031955859512019-11-19T08:47:00.001+01:002019-11-19T08:47:25.128+01:00Avoid wt.social sending mails all the timeIf you have signed in into wt.social lately you'll find that the new social media platform sends a lot of mails by default, to avoid that you can go to the menu->notifications section once you are logged in and uncheck all the email notifications.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYjzcbR5jtOl6xVa4EfkjKrBkErFstSJIhwjbcOPJVO6vLBKGYrIc3xEDuttLqFw9Q5Rzsn8oZdCLNEPz9mfHQG9eneHiP4OHoZ-iNuxCYKQuMqwRYmQauB6KRVXWwMniOow8a/s1600/unnamed+%25281%2529.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="900" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYjzcbR5jtOl6xVa4EfkjKrBkErFstSJIhwjbcOPJVO6vLBKGYrIc3xEDuttLqFw9Q5Rzsn8oZdCLNEPz9mfHQG9eneHiP4OHoZ-iNuxCYKQuMqwRYmQauB6KRVXWwMniOow8a/s320/unnamed+%25281%2529.jpg" width="180" /></a></div>
<br />Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-30693494739020056182019-09-12T14:36:00.000+02:002019-09-12T14:36:03.703+02:00Check if a folder is in use from PHP in a linux systemSample code to check if a file is in use before loading data, for example if an FTP is writing to the file.<br />
<br />
In fact we check for the entire folder, in this example a constant called DIR_XMLS, if any file is open in the operating system we abort the load.<br />
<br />
$file=DIR_XMLS.'xxx.xml';<br />
if (!file_exists($file)) die ("File $file does not exist, skipping step! \n");<br />
$chkcmd="lsof|grep ".DIR_XMLS."|wc -l";<br />
exec($chkcmd, $output, $return);<br />
if ($output[0]>0)<br />
{<br />
<span style="white-space: pre;"> </span> die("Aborting process ".DIR_XMLS." is in use!\n");<br />
}Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-61975735159554518332019-01-02T11:40:00.003+01:002019-01-02T11:56:15.405+01:00Post resum 2018<b>Gadgets of the year (comprats o regalats):</b><br />
Apple tv 4k 64Gbs<br />
Tenda wifi mesh<br />
Mando carregador per la Nintendo Switch<br />
<br />
<b>Samarretes del any:</b><br />
Mapachao de to!<br />
No spoilers please<br />
Nekobasu<br />
La invasion de los ultracuerpos<br />
<br />
<b>Friky coses guays:</b><br />
Codeception<br />
YAGNI<br />
<br />
<b>Jocs als que m'he viciat aquest any:</b><br />
Sparkle unleashed<br />
Sparkle 2<br />
Player Unknown Battlegrounds Mobile<br />
Overcooked 2<br />
<br />
<br />
<b>Grups guays que he descobert aquest any:</b><br />
The Brian Jonestown Massacre<br />
This Cold Night<br />
Klaus and Kinski<br />
Tronco<br />
Cariño<br />
<br />
<b>Millors concerts als que he anat:</b><br />
Primavera<br />
Cruilla<br />
Triangulo de amor bizarro al RAZZ<br />
<br />
<b>Millors pelis que he vist:</b><br />
The disaster artist<br />
Star wars: The last Jedi<br />
Nocturnal animals<br />
Muchos hijos un mono y un castillo<br />
Madre!<br />
Colossal<br />
The incredibles 2<br />
Teen titans go<br />
Los principios del cuidado<br />
Ralph rompe internet<br />
<br />
<b>Altres pelis que he vist:</b><br />
Steve Jobs<br />
Warcraft el origen<br />
Estiu 1993<br />
La llamada<br />
Black Panther<br />
Ready player one<br />
Annihilation<br />
Toni Erdman<br />
Infinity war<br />
Hereditary<br />
I am a Hero<br />
John Wick pacto de sangre<br />
Red<br />
Red 2<br />
Rey Arturo: la leyenda de Excalibur<br />
Jack Reacher<br />
Molly’s game<br />
Expediente Warren, El caso Endfield<br />
Kiki el amor se hace<br />
Multiple<br />
Operacion UNCLE<br />
<br />
<br />
<b>Millors pelis de Sitges:</b><br />
1. The House Jack Built<br />
2. Upgrade<br />
3. Await further instructions<br />
4. Monstrum<br />
5. Assassination Nation<br />
6. Lord of Chaos<br />
7. Under the silver lake<br />
8. Overlord<br />
9. I think we are alone now<br />
10. Parallel<br />
<br />
<b>Altres pelis vistes a Sitges:</b><br />
Ghostland<br />
Detective Dee and the four heavenly kings<br />
Life after flash<br />
Elisabeth Harvest<br />
Climax<br />
Summer of 84<br />
Aterrados<br />
Apostle<br />
Laika<br />
Liz and the blue bird<br />
Legend of the demon cat<br />
Mandy<br />
St. Agatha<br />
Journal 64<br />
He’s out there<br />
Animal<br />
Un coteau dans le coeur<br />
Fuga<br />
Lazzaro Feliche<br />
Dragged across concrete<br />
The unthinkable<br />
Muere monstruo, muere<br />
A rough draft<br />
Burning<br />
Kasane<br />
CAM<br />
Totoro<br />
I want to eat your pancreas<br />
Halloween<br />
<br />
<br />
<b>Curts:</b><br />
<br />
<br />
<b>Llibres que he llegit i m'han agradat:</b><br />
Chica, chico, chica<br />
<br />
<b>Comics:</b><br />
Saga<br />
Phonogram<br />
<br />
<b>Series a les que m'he enganxat (per ordre d'adiccio):</b><br />
Sharp objects<br />
Haunting of house hill<br />
Star Trek Discovery s1<br />
Flea Bag<br />
Dark<br />
Killing Eve s1<br />
The bodyguard s1<br />
Into the Badlands s1, s2<br />
Peaky blinders s1, s2, s3, s4<br />
The handmaid’s tale s1, s2<br />
Fariña<br />
The terror<br />
Preacher s1<br />
El dia de mañana<br />
Arde Madrid<br />
Sabrina<br />
<br />
<b>Teatre:</b><br />
Faemino y cansado, quién tuvo retuvo<br />
Ilustres ignorantes<br />
<br />
<b>Documentals:</b><br />
Categoria III<br />
The minimalists<br />
<br />
<b>Sortides al Extranjer:</b><br />
Madrid<br />
Lanzarote<br />
Valencia<br />
Bratislava<br />
Vienna<br />
Gunzburg (Legoland)<br />
Galicia<br />
<br />
<b>Millors Hotels als que he anat:</b><br />
La florida<br />
Vienna House Easy<br />
<br />
<b>Millors restaurants:</b><br />
Koy Shunka<br />
Gorria<br />
Mas que tapas, Reus<br />
Massana, Girona (2)<br />
Els pescadors<br />
Bratislavsky Mestiansky pivovar<br />
La forquilla<br />
Yoshino<br />
Puerta del Sol, Oropesa<br />
Takumi<br />
Disfrutar<br />
Culler de Pau<br />
Fogar de Santiso<br />
Tira do cordelAgustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-33299123993362900202018-01-02T15:48:00.001+01:002018-01-02T15:48:47.824+01:00Post resum 2017Post resum 2017, sense editar :)<br />
<br />
<b>Exits:</b><br />
null<br />
<br />
<b>Gadgets of the year (comprats o regalats):</b><br />
airpods<br />
cable usb-usbC<br />
iphone 8 plus<br />
carregador per induccio<br />
<br />
<b>Samarretes del any:</b><br />
hodor - hodor<br />
prodigy<br />
exquirla<br />
make eternia great again<br />
skydine<br />
ceci n'est pas une lune<br />
stranger things<br />
mammut floppy disk<br />
<br />
<br />
<b>Friky coses guays:</b><br />
vue.js<br />
<br />
<b>Jocs als que m'he viciat aquest any:</b><br />
yokai watch wiggle woggle<br />
<br />
<b>Grups guays que he descobert aquest any:</b><br />
Las Robertas<br />
Juvenilia<br />
La Sera<br />
Biznaga<br />
Rusos Blancos<br />
Sad Lovers & Giants<br />
Zuzu<br />
Death in june<br />
Young Prisms<br />
Minor Victories<br />
Velvet condom<br />
The Mantles<br />
D.A.R.K.<br />
Joanna Gruesome<br />
Speedy Ortiz<br />
Vaadat Charimig<br />
Be Forest<br />
A sunny day in Glasgow<br />
Tamaryn<br />
Exquirla<br />
Sparklehorse<br />
The Dears<br />
The organ<br />
Still corners<br />
Las Odio<br />
James Combs<br />
Human tetris<br />
<br />
<br />
<b>Millors concerts als que he anat:</b><br />
Primavera Sound<br />
Low<br />
Dissabte Cruilla<br />
Exquirla a l’Auditori<br />
Ojete Calor al razz clibs<br />
<br />
<b>Millors pelis que he vist:</b><br />
The revenant (El renacido)<br />
Escuadron suicida<br />
Marte (The Martian)<br />
Lego Batman<br />
Manchester by the sea<br />
Logan<br />
The Crow (phenomena)<br />
Moonlight<br />
John Carter from Mars<br />
Wienner Dog<br />
A bettersweet life<br />
La bella y la bestia<br />
Los pitufos y la aldea escondida<br />
Your name<br />
bebe jefazo<br />
john wick<br />
Alien Covenant<br />
Lesbian vampire killers<br />
Get Out<br />
The Priests<br />
El dictador<br />
Doctor Strange<br />
Inferno<br />
Seoul Station<br />
Dunkirk<br />
Wolf Children<br />
Emoji<br />
Ninjago<br />
It<br />
yokai watch<br />
Mal Nosso<br />
Laissez bronzer les cadavres<br />
Fireworks<br />
68 kill<br />
Blade of the immortal<br />
As boas maneiras<br />
Errementari (El herrero y el diablo)<br />
A silent voice<br />
The brink<br />
Pokemon: te elijo a ti<br />
La liga de la justicia<br />
Coco<br />
The killing of a sacred deer<br />
Julieta<br />
Bright<br />
<br />
<br />
<b>Curts:</b><br />
Waste<br />
Eldrich code<br />
Bruce Gallagan<br />
Still<br />
Preston<br />
Massage<br />
Behind<br />
Les animaux domestiques<br />
Ringo rocket star (yuri gagarin)<br />
<br />
<br />
<br />
<b>Llibres que he llegit i m'han agradat:</b><br />
Las chicas, Emma Cline<br />
Alta fidelidad, Nick Hornby<br />
Harry Potter y el legado maldito, JK Rowling<br />
El problema de los tres cuerpos<br />
Farishta<br />
Estados unidos de Japon<br />
This time is different<br />
<br />
<br />
<b>Comics:</b><br />
Creixer es un mite, Sarah Scribbles<br />
League of extraordinary gentlemen, vol3<br />
Ojos grises<br />
<br />
<b>Series a les que m'he enganxat (per ordre d'adiccio):</b><br />
Stranger things s2<br />
Game of thrones s7<br />
Vikings s1 s2 s3 s4<br />
Fargo s2<br />
Gilmore Girls (a year in the life)<br />
American crime history: OJ Simpson<br />
Taboo s1<br />
Mind Hunters s1<br />
Picky blinders s1<br />
Fargo s3<br />
Narcos s1 i s2<br />
Transparent s3<br />
Legion s1<br />
<br />
<b>Teatre:</b><br />
Medusa<br />
<b><br /></b>
<b>Documentals:</b><br />
Soñar el futuro<br />
<br />
<b><br /></b>
<b>Sortides al Extranjer:</b><br />
Madrid<br />
Benidorm<br />
<br />
<b>Millors Hotels als que he anat:</b><br />
Barcelo Occidental Madrid Este<br />
Miramar, Barcelona<br />
<br />
<b>Millors restaurants:</b><br />
Las 9 reinas<br />
Al-mounia, Madrid<br />
El Brillante, Madrid<br />
La cofradia, Benidorm<br />
Una mica de japo<br />
Els pescadors<br />
Nikkei 136<br />
La glorieta del castellAgustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-75684564358722150392017-06-04T12:20:00.003+02:002017-06-04T12:20:30.180+02:00El meu Primavera Sound 2017Resum dels concerts que he vist aquest 2017 al Primavera:<br />
<br />
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">29/05 Apolo:</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Jeremy Jay</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">The Wave pictures</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal; min-height: 17.2px;">
<span style="font-size: 15pt;"></span><br /></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">31/05 la2 Apolo:</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Retirada!</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">The Wedding Present</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal; min-height: 17.2px;">
<span style="font-size: 15pt;"></span><br /></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">01/06 forum:</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Pinegrove</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Kokoshca</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Cymbals Eat Guitars</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Mishima</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Triangulo de amor bizarro</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Arcade Fire (secret show)</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">The Molocks</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal; min-height: 17.2px;">
<span style="font-size: 15pt;"></span><br /></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">02/06 forum:</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">El petit de cal Eril</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">It's Not Not</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Vadaat Charimig</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Mitski</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">The Magnetic fields</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Arab strap</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">The Make-Up</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal; min-height: 17.2px;">
<span style="font-size: 15pt;"></span><br /></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">03/06 forum:</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Les Cruet</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Pond</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Van Morrison</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Metronomy</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Prairie WWWW (ultim tema)</span></div>
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Arcade Fire</span></div>
<br />
<div style="-webkit-text-stroke-color: rgb(0, 0, 0); -webkit-text-stroke-width: initial; font-family: Helvetica; font-size: 15px; line-height: normal;">
<span style="font-size: 15pt;">Japandroid (3 temes)</span></div>
Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-25865567120029602592017-01-01T09:13:00.000+01:002017-01-01T09:19:22.122+01:00Post resum 2016Com sempre ho pujo sense editar, aquest any inauguro una nova secció d'exits (sortides) amb les desinversions que hem fet, per diferents motius.<br />
<br />
Exits:<br />
Zeebe<br />
NiceTales<br />
Healthia<br />
Washrocks<br />
<br />
Gadgets of the year (comprats o regalats):<br />
ipad Air 2<br />
PS VR per omatech<br />
termostat NetAtmo<br />
<br />
Samarretes del any:<br />
wally darth vader, pampling<br />
tim burton globus, pampling<br />
disobey, pampling<br />
kill all humans, pampling<br />
know nothing, pampling<br />
Darth Vader i Kylo Ren el rey leon, pampling<br />
Lobezno, pampling<br />
Pixies<br />
The Cure<br />
<br />
Friky coses guays:<br />
Docker<br />
jira+bitbucket<br />
GraphQL a prod<br />
<br />
Jocs als que m'he viciat aquest any:<br />
pokemon go<br />
until down, rush of blood<br />
<br />
Grups guays que he descobert aquest any:<br />
Beach Slang<br />
Wild Nothing<br />
Alex G<br />
Kim Taylor<br />
In heaven<br />
Slaves<br />
Sports<br />
Youth Lagoon<br />
Lua Gramer<br />
Upset<br />
Half Moon Run<br />
Spain<br />
Soledad Velez<br />
Andy Shauf<br />
Mice Parade<br />
Red blood shoes<br />
The twilight sad<br />
Jeffrey Lewis<br />
Gudar<br />
Day Wave<br />
Tess Parks<br />
Beach Fossils<br />
Pony up!<br />
Rival Schools<br />
Neutral Milk Hotel<br />
Merchandise<br />
Cranes<br />
True Widow<br />
Eugene McGinnes<br />
Salad boys<br />
Seapony<br />
<br />
<br />
Millors concerts als que he anat:<br />
Wolf Alice al Razz2<br />
Los Punsetes al caraB<br />
Florence and the machine al Sant Jordi<br />
Dimecres PS 2016:<br />
El último vecino, Sr. Chinarro, Suede, Mueran humanos i Young Husband<br />
Dijous PS 2016:<br />
- Mueran humanos<br />
- Car seat headrest<br />
- Daughter<br />
Divendres PS 2016:<br />
- Alex G<br />
- Savages<br />
- Dinosaur jr. (i la zona vip deserta amb tothom a radiohead)<br />
Dissabte PS2016:<br />
- Die Katapult<br />
- Odd Cherry pie<br />
- Wild Nothing<br />
- Jenny Hval<br />
- PJ Harvey<br />
Dijous al bbk live: Chvrches, M83, Arcade Fire, Hotchip<br />
Divendres bbk live: Grimes i Pixies (red blood shoes tambe vaig veure un troç i va molar)<br />
Dissabte bbk live: León Benavente, Juventud Juché, McEnroe, León Benavente (one more time), Triángulo de amor Bizarro, Wolf Alice.<br />
Sr. Chinarro, BAM<br />
Triangulo de amor bizarro, BAM<br />
Gudar, almo2bar<br />
Hazte Lapon, almo2bar<br />
Pixies, Sant Jordi Club<br />
The Cure, Palau Sant Jordi (and twilight sad)<br />
El ultimo vecino, al Maremagnum<br />
<br />
Millors pelis que he vist:<br />
The young frankenstein al phenomena<br />
Macbeth al verdi<br />
The Lobster<br />
She's lost control<br />
Requisitos para ser una persona normal<br />
Le decline de l'empire Americane<br />
Les invasions barbares<br />
A teacher<br />
I used to be darker<br />
L'age des tenebres<br />
Begin again<br />
Zootropolis<br />
Anomalisa<br />
The hateful eight<br />
El juego de Ender<br />
El recuerdo de Marnie<br />
Kung-fu panda 3<br />
Nacion Prozac<br />
Reservoir Dogs<br />
Kick-ass<br />
Ant-Man<br />
Holy smoke<br />
Sleepwalk with me<br />
Boyhood<br />
The program (El idolo)<br />
Kingsman, the secret service<br />
What we do in darkness<br />
El arte de amar<br />
Mascotas<br />
American Gangster<br />
X-Men Apocalypse<br />
Kubo<br />
Star Trek beyond<br />
Invasion<br />
Estado de sitio<br />
Sing Street<br />
ciguenyas<br />
Money Monster<br />
Captain America: Civil war<br />
Mad Max, fury road<br />
Ae dil hai mushkil<br />
Captain fantastic<br />
Where to invade next<br />
10 cloverfield lane<br />
Nanny diaries<br />
Sully<br />
Un dia perfecto<br />
Mejor solteras<br />
Vaiana<br />
Star Wars Rogue One<br />
Deadpool<br />
Arrival<br />
<br />
Altres pelis que he vist:<br />
El viaje de Arlo a Glories<br />
Resacon en las vegas<br />
Dragon ball Z, la batalla de los dioses<br />
La millor opcio<br />
<br />
Curts:<br />
Mr. Hublot<br />
Pipas<br />
Rise<br />
<br />
Llibres que he llegit i m'han agradat:<br />
El sabotaje amoroso, Amelie Nothomb<br />
El primer hombre malo, Miranda July<br />
Hombres sin mujeres, Haruki Murakami<br />
Ready Player One, Ernest Cline<br />
Armada, Ernest Cline<br />
Yo fui a EGB 3<br />
Buddishm a graphic guide<br />
<br />
<br />
Comics:<br />
La casa, Paco Roca<br />
Una semana de cada dos,<br />
El Club de la lucha 2, Chuck Palaniuck<br />
<br />
Series a les que m'he enganxat (per ordre d'adiccio):<br />
Stranger things s1<br />
West world s1<br />
Mr Robot s1<br />
War and peace<br />
Game of thrones s6<br />
Silicon Valley s3<br />
X-files s10<br />
<br />
Teatre:<br />
L'Avar, Goya<br />
<br />
Documentals:<br />
Me @ the zoo<br />
Gameplay: la historia de los videojuegos<br />
Growing up Trans<br />
Ground breakers, Steve Jobs<br />
Ground breakers, Bill Gates<br />
The money trap, Panorama BBC<br />
Exit through the gift shop<br />
<br />
<br />
Sortides al Extranjer:<br />
Bilbao<br />
Madrid<br />
Ahmedabad, India<br />
Londres<br />
Darmstadt<br />
<br />
Millors Hotels als que he anat:<br />
Caspian, Ahmedabad<br />
<br />
Millors restaurants:<br />
Miu<br />
Fonda Marina, Montgat<br />
Cal Lluis, Sant Pol<br />
Emporium, Montgat<br />
Al paseo<br />
Can Mas Ferrer<br />
Langos! a Darmastadt<br />
Hungaryto<br />
<br />Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-61582185487557768382016-09-15T19:04:00.001+02:002018-06-06T15:21:53.100+02:00How to require autoload in vendor or outside vendor folderSometimes when you create a package for composer and want to create some example code you need to execute those examples as an standalone package or once included in a vendor folder of another project.<br />
<br />
Use this simple trick in your example php files to require autoload in any location.<br />
<br />
$autoload_location = '/vendor/autoload.php';<br />
$tries=0;<br />
while (!is_file(__DIR__.$autoload_location))<br />
{<br />
<span style="white-space: pre;"> </span>$autoload_location='/..'.$autoload_location;<br />
<span style="white-space: pre;"> </span>$tries++;<br />
<span style="white-space: pre;"> </span>if ($tries>10) die("Error trying to find autoload file\n");<br />
}<br />
require_once __DIR__.$autoload_location;<br />
<div>
<br /></div>
<div>
<br /></div>
OLD VERSION:<br />
<br />
<pre>$autoload_location=__DIR__.'/../vendor/autoload.php';
if (!is_file($autoload_location)) $autoload_location='../../../autoload.php';
require_once $autoload_location;</pre>
<pre></pre>
<pre><div>
</div>
</pre>
<br />Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-66696317065197815952016-01-01T21:41:00.001+01:002017-11-14T17:32:34.176+01:00Post resum 2015Com sempre sense editar...<br />
<br />
<br />
<b>Gadgets of the year (comprats o regalats):</b><br />
iPhone 6s<br />
<br />
<b>Samarretes del any:</b><br />
Heisenberg<br />
Easypromos<br />
<br />
<b>Friky coses guays:</b><br />
Sled Dogs Snowskates<br />
Emulador d'Amiga FE-UAE per Mac<br />
Ulo<br />
<br />
<b>Jocs als que m'he viciat aquest any:</b><br />
Star Wars: Commander<br />
Finalizer, super transformation - Mame<br />
Monument Valley<br />
<br />
<b>Grups guays que he descobert aquest any:</b><br />
Crystal fighters<br />
Wolf Alice<br />
Metric<br />
Courtney Barnett<br />
Viet Cong<br />
Trementina<br />
León Benavente<br />
Sur la planche - la femme<br />
Hazte Lapón<br />
Bastante<br />
War paint<br />
L.A.<br />
Los Punsetes<br />
El último vecino<br />
Torres<br />
Gente Joven<br />
Indigo Girls<br />
<br />
<b>Millors concerts als que he anat:</b><br />
Ride al PS15<br />
Belle and Sebastian al PS15<br />
Florence and the Machine al FIB15<br />
Sr. Chinarro on the roof<br />
Crystal fighters al FIB15 i al BAM<br />
Los Punsetes al BAM<br />
Mishima al BAM<br />
Mourn al BAM<br />
Sr. Chinarro i Leon Benavente a la Capsa<br />
Johanna Newsom al Barts<br />
Sr. Chinarro al Heliogabal<br />
Kings of Convenience al Apolo<br />
<br />
<br />
<b>Millors pelis que he vist:</b><br />
Fight Club al phenomena al cine!<br />
Big Hero 6<br />
La Reunion<br />
Primos<br />
Closer<br />
Olvidate de mí<br />
Birdman<br />
Frank<br />
The imitation game<br />
Relatos salvajes<br />
Los minions<br />
Del reves<br />
El extraordinario viaje de T.S. Spivet<br />
Ex Machina<br />
El hobbit, la batalla de los cinco ejercitos<br />
When we're young<br />
Francesc Ha<br />
Gone girl (perdida)<br />
Chappie<br />
The interview<br />
Hombres, mujeres y niños<br />
Elliot Smith: Heaven adores you<br />
Automata<br />
Sexo facil, peliculas tristes<br />
Akira<br />
La mecanica del corazon<br />
Quemar despues de leer<br />
Star Wars, el despertar de la fuerza<br />
Los vengadores la era de Ultron<br />
<br />
<b>Altres pelis que he vist:</b><br />
Twix<br />
Indomable (Haywire)<br />
Aprendiz de gigolo<br />
El amanecer del planeta de los simios<br />
Guardianes de la galaxia<br />
Too big to fail<br />
Malditos vecinos<br />
La vida secreta de Walter Mitty<br />
Sex Tape, algo pasa en la nube<br />
Open Windows<br />
1000 maneras de morder el polvo<br />
Al filo del mañana<br />
La obeja Shaun<br />
Zero Charisma<br />
No hay dos sin tres<br />
Lucy<br />
El calentito<br />
Hacemos una porno?<br />
dos tontos muy tontos 2<br />
Mortdecai<br />
Felices 140<br />
El amor y otras cosas imposibles<br />
50 sombras de grey<br />
Corazones de acero<br />
La montaña rusa<br />
Regression<br />
Eagle eye<br />
Las novias de mis amigos<br />
Barbacoa de amigos<br />
<br />
<b>Curts:</b><br />
Cowboys<br />
2037<br />
<br />
<b>Llibres que he llegit i m'han agradat:</b><br />
La nostalgia feliz, Amelie Nothomb<br />
Condenada, Chuck Palahniuk<br />
Pequeño circo, Nando Cruz<br />
Maldita, Chuck Palahniuck<br />
<br />
<b>Comics:</b><br />
<br />
<b>Series a les que m'he enganxat (per ordre d'adiccio):</b><br />
Versailles s1<br />
Transparent s1 s2<br />
Game of thrones s5<br />
Mozart in the jungle s1<br />
Penny dreadful s2<br />
You're the worst s1<br />
Catastrophe s1<br />
<br />
<b>Teatre:</b><br />
<br />
<b>Documentals:</b><br />
La historia de Frozen<br />
The internet own's boy<br />
Ciutat morta<br />
Print the legend<br />
Las super bacterias<br />
Epidemias, la amenaza invisible<br />
Amy<br />
<br />
<b>Sortides al Extranjer:</b><br />
Benicassim<br />
<br />
<b>Millors Hotels als que he anat:</b><br />
NH a Castello<br />
<br />
<b>Millors restaurants:</b><br />
El xiringuito de l'Escriba<br />
Els Pescadors<br />
<div>
<br /></div>
Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-16971458290749674592015-07-14T08:51:00.004+02:002015-07-14T08:51:39.463+02:00How to send you an email with your mysql slave seconds behind master valueIt's dead simple, just schedule a crontab with this line:<br />
<br />
mysql -u root -p<your_password> -e "show slave status \G"|grep Seconds | mail -s "Seconds behind master" <email_address><br /></email_address></your_password><br />
<br />
This will query the slave status, grep the most important line and send you an email.<br />
<br />
Hope this helpAgustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-29186734901153873422015-06-12T13:05:00.002+02:002015-06-12T13:05:23.544+02:00How to query a memcache top using shell scriptIn case you want to watch the most important parameters of your memcache installation you can use this basic shell script:<br />
<br />
watch "echo stats | nc 127.0.0.1 11211 |grep -v conn_yields |grep -v time|grep -v cmd|grep -v threads \<br />|grep -v evictions|grep -v reclaimed|grep -v auth|grep -v pointer_size|grep -v accepting_conns \<br />|grep -v bytes_read|grep -v bytes_written|grep -v badval|grep -v structures|grep -v pid \<br />|grep -v version|grep -v rusage|grep -v incr|grep -v decr|grep -v listen|grep -v cas \<br />|grep -v total_connections|grep -v delete|grep -v total_items|grep -v END"<br />
<br />
It shows the most important parameters every two seconds ignoring the other ones, you can tune the showed params removing grep -v commands at your will.<br />
<br />
Enjoy!<br />
<br />
<br />Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0tag:blogger.com,1999:blog-7098481.post-42131112229142044542015-01-07T07:42:00.002+01:002015-01-07T07:42:38.244+01:00Resum de l'any 2014Com cada any publico un resum del que ha estat el 2014 en diferents categoríes, sobretot com a recordatori personal.<br />
<br />
No edito gaire perquè els nens estàn a punt de llevar-se :)<br />
<br />
<b>Gadgets of the year (comprats o regalats):</b><br />
Xarxa PLC amb Wifi<br />
Impressora HP Deskjet Wifi<br />
<br />
<b>Samarretes del any:</b><br />
Piedra, papel, tijera, lagarto, spock<br />
<br />
<b>Friky coses guays:</b><br />
mailgun<br />
mandrill<br />
telegram<br />
que seth macfarlane (padre de familia) es productor del nou Cosmos<br />
que el prota de Prison Break es el guionista d'Stoker<br />
Jacob Dhein mola molt<br />
Kibana<br />
red herring (literalment arenque rojo, metaforicament pista falsa)<br />
<br />
<b>Jocs als que m'he viciat aquest any:</b><br />
StarWars Commander<br />
<br />
<b>Grups guays que he descobert aquest any:</b><br />
Desert<br />
<br />
<b>Millors concerts als que he anat:</b><br />
Arcade Fire<br />
Pixies<br />
<br />
<b>Millors pelis que he vist:</b><br />
The wolf of wall street<br />
django unchained<br />
Magnolia<br />
Las brujas de zagarramurdi<br />
<div>
Stoker</div>
<div>
Un heureux evenement</div>
<div>
X-Men days of future past<br />
Lobezno inmortal<br />
Grand Hotel Budapest</div>
<div>
Rushmore</div>
<div>
La LEGO pelicula</div>
<div>
Stockholm</div>
<div>
God help the girl</div>
<div>
nebraska<br />
¿que hacemos con maisie?</div>
<div>
dallas buyers club<br />
La ultima nit de Boris Grushenko</div>
<div>
Capitan America, soldado de invierno</div>
<div>
<br /></div>
<b>Altres pelis que he vist:</b><br />
ironman 3<br />
Mama<br />
Her<br />
After earth<br />
Movie 43<br />
En llamas<br />
The Cabin in the woods<br />
Battleship<br />
Lincoln<br />
Oblivion<br />
Si fuera facil<br />
In time<br />
Sinister<br />
Elyseum<br />
Ilusion<br />
Ruby Sparks<br />
Jobs<br />
The Internship<br />
El profesional, Leon<br />
Pacific Rim<br />
Jackie Brown<br />
SpringBreakers<br />
La vida de Adele<br />
Boogie nights<br />
World War Z<br />
Gravity<br />
Don Jon<br />
Las ventajas de ser un marginado<br />
La gran familia Española<br />
El Mayordomo<br />
El hombre de acero<br />
Juegos secretos<br />
La lista<br />
Once<br />
Salvajes<br />
La purga<br />
Thor el reino oscuro<br />
Un hombre solitario<br />
Quien mato a bambi<br />
Hannah Arendt<br />
Lio embarazoso<br />
Wallstreet<br />
nymphomaniac 1 i 2<br />
El canguro<br />
Clear History<br />
Una juerga de pelotas<br />
El perfume<br />
Supersalidos<br />
Asalto al poder (Whitehouse down)<br />
La gran estafa americana<br />
Blue Jasmine<br />
robocop 2014<br />
The bling ring<br />
Prisioneros<br />
Agosto<br />
la leyenda del samurai - 47 ronin<br />
Amazing Spiderman 2: El poder de Electro<br />
<br />
<b>Curts:</b><br />
Voice Over<br />
La rubia de Pinos puente<br />
Validation<br />
<br />
<b>Llibres que he llegit i m'han agradat:</b><br />
Desert<br />
<br />
<b>Comics:</b><br />
Los surcos del azar, Paco Roca<br />
Crisis de ansiedad, Juanjo Saez<br />
Realidad a la piedra, Joaquin Reyes<br />
El otro mar, Alfonso Zapico<br />
Battle of the atom<br />
Guia del mal padre 2<br />
Manual para padres frikis, año 0<br />
Sansamba<br />
cooltureta<br />
Degenerados<br />
<br />
<b>Series a les que m'he enganxat (per ordre d'adiccio):</b><br />
Fargo s1<br />
Juego de tronos s4<br />
True Detective s1<br />
Downton Abbey s4, s5<br />
Silicon Valley s1<br />
Penny dreadful s1<br />
Halt and catch fire s1<br />
Parenthood s4 s5<br />
The leftovers s1<br />
Portlandia s4<br />
Dates s1<br />
The strain s1<br />
Believe s1<br />
Los 100 s1<br />
Capture s1<br />
The writers room<br />
Gadget man s1<br />
<br />
<b>Teatre:</b><br />
Desert<br />
<br />
<b>Documentals:</b><br />
ComicCon<br />
europe in 8-bits<br />
Mel Brooks, haz ruido<br />
El culo del mundo<br />
The punk singer<br />
La mentira de Lance Armstrong<br />
We steal secrets: La historia de Wikileaks<br />
Donald Rumsfeld: certezas desconocidas<br />
InRealLife (La Red)<br />
Los 90: la decada que nos conecto<br />
There will be dragons<br />
<br />
<b>Sortides al Extranjer:</b><br />
EuroDisney<br />
Madrid<br />
<br />
<b>Millors Hotels als que he anat:</b><br />
Desert<br />
<br />
<b>Millors restaurants:</b><br />
Bacoa<br />
Osmosis<br />
El cau del pescador<br />
Els pescadors<br />
Gorria<br />
Le 58<br />
<br />
<br />Agustí Ponshttp://www.blogger.com/profile/11432871832475029159noreply@blogger.com0