Skip to content

Instantly share code, notes, and snippets.

View zetxek's full-sized avatar
🐢
TEENAGE MUTANT NINJA TURTLES - Heroes in a half shell!

Adrián Moreno Peña zetxek

🐢
TEENAGE MUTANT NINJA TURTLES - Heroes in a half shell!
View GitHub Profile
@zetxek
zetxek / gmaps-shadowban.js
Created January 12, 2023 20:41
checking when google maps stopped shadow banned me
/**
* To learn more about Playwright Test visit:
* https://www.checklyhq.com/docs/browser-checks/playwright-test/
* https://playwright.dev/docs/writing-tests
*/
const { expect, test } = require("@playwright/test")
test("check review number=466", async ({ page }) => {
const response = await page.goto(
@zetxek
zetxek / google-translate-bookmarklet.js
Last active July 2, 2022 17:08
Google translate bookmarklet code - to load a google translate bar.
// create it in your browser by copying the rest of the script - and appending the "address" with "javascript: ", and then paste the code
try {
console.log("starting, inserting script");
languages = "en,es,da";
o = document.createElement("scri" + "pt");
o.setAttribute(
"src",
"https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"
);
o.setAttribute("type", "text/javascript");
@zetxek
zetxek / ec2-host-from-tag-to-env-vars.sh
Last active February 22, 2020 17:46 — forked from marcellodesales/ec2-host-from-tag-to-env-vars.sh
Create Environment Variables in EC2 Hosts from EC2 Host Tags (including AWS-generated variables)
######
# Author: Adrian Moreno, based on Marcelo de Salles' script: https://gist.github.com/marcellodesales/a890b8ca240403187269
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
# Changes from original:
# - removed the need of passing region to the tags command in AWS
# - processing aws generated variables (with ":" on their value of key)
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
@zetxek
zetxek / bash_completion-ssh
Created January 15, 2020 09:16
Autocomplete ssh hosts
_ssh()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-)
COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
return 0
041b88b7a1bb951aec348a0d1964eee09c53aada7b7bacae6f80f472c6952e0eee57bce6913fbd7dad6b95ced6c3bd0ed6545045368748d10f7f5b11c7dbe5c010;andreiidu
@zetxek
zetxek / run.sh
Last active January 19, 2017 16:50 — forked from jamesonjlee/run.sh
running AWS Cloudwatch Monitor tool on CentOS6.5 without having EC2 roles in place
yum install -y perl-CPAN nano wget zip unzip perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https gcc gcc-c++ make openssl-devel
export PERL_MM_USE_DEFAULT=1
# setup default config
perl -MCPAN -e shell # make sure to exit
# need to wait here
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "Bundle::CPAN")'
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "CPAN")'
perl -MCPAN -e 'CPAN::Shell->rematein("notest", "install", "Bundle::LWP")'
@zetxek
zetxek / countfiles_and_divide.sh
Created March 21, 2016 16:15
Count the number of files containing a string in the filename in a directory and folders, then divide that number by another, and print it to the console
echo `ls * | grep https | wc -l`/2 | bc -l
@zetxek
zetxek / keybase.md
Last active August 29, 2015 14:20
keybase.md

Keybase proof

I hereby claim:

  • I am zetxek on github.
  • I am zetxek (https://keybase.io/zetxek) on keybase.
  • I have a public key whose fingerprint is 1763 B070 9D8E BFB5 30F6 2CB7 5F3E 4ACC 9BEF 92EA

To claim this, I am signing this object:

@zetxek
zetxek / font-listing.c
Last active August 29, 2015 14:02
List available fonts on iOS
// List all fonts on iPhone
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
@zetxek
zetxek / 20140428223544_add_lower_unaccent_function_to_db.rb
Created April 28, 2014 23:12
Rails migration to create a Postgresql function that stripts every accent and outputs the string as lowercase, as seen in http://stackoverflow.com/questions/9243322/postgres-accent-insensitive-like-search-in-rails-3-1-on-heroku
# -*- encoding : utf-8 -*-
class AddLowerUnaccentFunctionToDb < ActiveRecord::Migration
def self.up
execute "CREATE OR REPLACE FUNCTION lower_unaccent(character varying)
RETURNS text
AS $$
SELECT lower(translate($1
, '¹²³áàâãäåāăąÀÁÂÃÄÅĀĂĄÆćčç©ĆČÇĐÐèéêёëēĕėęěÈÊËЁĒĔĖĘĚ€ğĞıìíîïìĩīĭÌÍÎÏЇÌĨĪĬłŁńňñŃŇÑòóôõöōŏőøÒÓÔÕÖŌŎŐØŒř®ŘšşșߊŞȘùúûüũūŭůÙÚÛÜŨŪŬŮýÿÝŸžżźŽŻŹ'
, '123aaaaaaaaaaaaaaaaaaacccccccddeeeeeeeeeeeeeeeeeeeeggiiiiiiiiiiiiiiiiiillnnnnnnooooooooooooooooooorrrsssssssuuuuuuuuuuuuuuuuyyyyzzzzzz'
));