Skip to content

Instantly share code, notes, and snippets.

@caarmen
caarmen / fixrabbitmq.md
Created June 30, 2023 15:33
reinstall rabbitmq on ubuntu
@caarmen
caarmen / fixdbcharset.md
Created June 28, 2023 11:05
mysql/mariadb: fix weird errors about fk constraints, when the real problem is database charset

Dump the whole database:

mysqldump -u myuser my_database -p > dump.sql

Open the dump.sql file.

Do a search and replace: for example replace all occurrences of utf8mb3 with utf8mb4. Save the file.

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Poema del día de Francisco Álvarez Hidalgo</title>
<link rel="alternate" href="http://www.poesiadelmomento.com" />
<link rel="self" href="http://www.poesiadelmomento.com/poemadeldia.xml" />
<subtitle>Poema del día de Francisco Álvarez Hidalgo</subtitle>
<id>http://www.poesiadelmomento.com/</id>
<updated>2022-10-08T16:19:32.274011+00:00</updated>
<dc:date>2022-10-08T16:19:32.274011+00:00</dc:date>
<entry>
@caarmen
caarmen / swapi-graphql-client.py
Last active May 22, 2022 16:20
Script to retrieve paginated data from the star wars graphql server.
"""
Exploration of a graphql client in Python
"""
import asyncio
from dataclasses import dataclass
from typing import Generator
from gql import gql
from gql.client import Client, AsyncClientSession
from gql.transport.aiohttp import AIOHTTPTransport
@caarmen
caarmen / reinstall-mariadb-mysql.txt
Last active May 20, 2022 15:12
reinstall mariadb/mysql on mac
Remove contents of /usr/local/var/mysql
brew uninstall mysql
brew uninstall mariadb
brew install mariadb
mysql_install_db
mysql.server start
sudo mysql
- this opens a session. Just exit mysql for now
mysql_secure_installation
- Answer yes to everything
Language feature Kotlin Scala
val hello="foo"
@caarmen
caarmen / adball.bash
Last active July 23, 2016 22:50
adb-all bash function
#test
adb-all()
{
adb devices | while read line
do
if [ ! "$line" = "" ] && [ `echo $line | awk '{print $2}'` = "device" ]
then
device=`echo $line | awk '{print $1}'`
echo "$device:"
adb -s $device $@
@caarmen
caarmen / genymotion_rotate.sh
Created June 3, 2016 09:17
Rotate genymotion in a loop
x=0
while [ 1 ]
do
x=`expr \( $x + 90 \) % 360 `
/Applications/Genymotion\ Shell.app/Contents/MacOS/genyshell -c "rotation setangle $x"
sleep 1
done
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf