Skip to content

Instantly share code, notes, and snippets.

@fakechris
fakechris / Output
Created July 24, 2023 01:50 — forked from emanonwzy/Output
ZZ. @老赵 生成一段Typoglycemia文本.Typoglycemia是个新词,描述的是人们识别一段文本时的一个有趣的现象:只要每个单词的首尾字母正确,中间的字母顺序完全打乱也没有关系,照样可以正常理解。
Original String:
I couldn't believe that I could actually understand what I was reading:
the phenomenal power of the human mind. According to a research team at Cambridge University,
it doesn't matter in what order the letters in a word are, the only important thing is that the
first and last letter be in the right place. The rest can be a total mess and you can still read
it without a problem. This is because the human mind does not read every letter by itself, but the
word as a whole. Such a condition is appropriately called Typoglycemia. Amazing, huh? Yeah and you
always thought spelling was important.
Converted String:
@fakechris
fakechris / verify_google_ips.sh
Created April 28, 2023 23:06 — forked from oasisfeng/verify_google_ips.sh
Shell script to verify connectable Google IPs
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <IP>[/subnet]"
exit 1
fi
for ip in $(nmap -sL $1 | awk '/Nmap scan report/{print $NF}'); do {
ip=$(echo $ip | tr -d '()')
output=$(curl --connect-to :443:$ip:443 --connect-timeout 5 --verbose --head https://www.google.com.hk 2>&1)
@fakechris
fakechris / qingcloud_backup.py
Created January 29, 2015 06:38
Backup your qingcloud resources
#!/usr/bin/env python
#coding: utf8
import gflags
import sys
import subprocess
import json
from operator import itemgetter, attrgetter, methodcaller
gflags.DEFINE_integer('limit', 2, 'how many full backup point')
@fakechris
fakechris / pydy.ipynb.json
Created April 16, 2014 08:13
pydy utils1
{
"metadata": {
"name": "pydy"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": "Python Tutorials3"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@fakechris
fakechris / Python Tutorials 2.ipynb.json
Created April 7, 2014 09:01
Python Tutorials dict and list
{
"metadata": {
"name": "Python Tutorials 2"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": "Python String Tutorials"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import shutil
import json
import getopt
import urllib2
from urllib import urlencode
import simplejson
import subprocess
USERNAME='user'
PROJECT='prj'
HOST='192.168.0.1'
ls_cmd = "ssh -p 29418 %s@%s gerrit query limit:1000 --current-patch-set --format=json status:open project:%s" % (USERNAME, HOST, PROJECT)
submit_cmd = "ssh -p 29418 %s@%s gerrit review --code-review 2 --abandon %s"
delimiter #
create trigger fix_dot_account_external_ids after insert on account_external_ids
for each row
begin
SET @external_id = NEW.external_id;
if @external_id like 'gerrit:*' then
SET @new_external_id = REPLACE(@external_id, 'gerrit:', 'username:');
insert into account_external_ids (account_id, email_address, password, external_id) values (new.account_id, new.email_address, new.password, @new_external_id);
end if;