Skip to content

Instantly share code, notes, and snippets.

View izabera's full-sized avatar

Isabella Bosia izabera

  • DDN
  • Flitwick, UK
View GitHub Profile
@izabera
izabera / gist:a76b47def8c57f40e54e
Last active August 29, 2015 14:05
kvirc acronym generator
%word=$0-
say Acronym for $b%word$b":"
exec("for w in `echo '$str.lowcase(%word)' | grep -o .`; do grep ^\$w /usr/share/dict/words | shuf | head -n1; done | perl -pe 's/^(.)/\\u\\1/g' | perl -pe 's/\n/ /g' | perl -pe 's/$/\n/'") {say $1;}
#replace /usr/share/dict/words with any word list
@izabera
izabera / cifre.cpp
Created September 8, 2014 18:50
converte numeri in lettere in italiano, accetta input da file o da stdin
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
string unita[10] = {"","uno","due","tre","quattro","cinque","sei","sette","otto","nove"};
string decine[10] = {"","dieci","venti","trenta","quaranta","cinquanta","sessanta","settanta","ottanta","novanta"};
string teen[10] = {"","undici","dodici","tredici","quattordici","quindici","sedici","diciassette","diciotto","diciannove"};
string una (int num) {
@izabera
izabera / gist:27303b9e143151fe4047
Last active August 29, 2015 14:06
kvirc compare users between two channels
if (!$0) {
echo Usage: /compareusers #chanA [#chanB]
echo If no #chanB is provided, use current chan
halt
}
%chana = $0
if (!$1) {
if ($window.type != "channel") {
@izabera
izabera / sillabah.sh
Created September 11, 2014 03:59
programmino per vincere a sillabah
#!/bin/bash
grep $1 /usr/bin/izastuff/anagram-dict/italiano | grep -E "^.{1,$2}$" | sillacalc ${*:3} | sort -nr | head
@izabera
izabera / randnick
Last active August 29, 2015 14:06
random nickname generator
#!/bin/bash
# not so fast but nicknames are pretty
nick=$(grep -E "^[a-zA-Z]{3,5}$" /usr/share/dict/words | shuf | head -n2 | tr -d "\n")
num=$(seq 10 99 | shuf | head -n1)
fullnick=$nick$num
echo $fullnick
@izabera
izabera / fingers.cpp
Last active August 29, 2015 14:06
is this word hard to type on a keyboard?
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int inwhich (string tofind, vector<string> options) {
for (unsigned int i = 0; i < options.size(); i++) if (options[i].find(tofind) != string::npos) return i;
return -1;
}
@izabera
izabera / Makefile
Last active August 29, 2015 14:06
compute ulam numbers (uses OpenMP to allow multithreading)
all:
g++ -march=native -Ofast -o ulam ulam.cpp
g++ -march=native -Ofast -fopenmp -o ompulam ompulam.cpp
@izabera
izabera / gist:d073487a490cacd3757b
Last active August 29, 2015 14:07
kvirc call all users in a chan
if ($0) {
%message = "==> $0-"
}
if ($window.type != "channel") {
echo Must be in a channel
halt
}
%call = ""
foreach (%user, $chan.users)
#!/usr/bin/env bash
for i in {1..64}; do trap "signal $i" "$i" ; done
signal () {
echo "Caught signal: $(kill -l "$1")"
echo "Value: $1"
}
while :; do :; done
#!/bin/sh
# NAME
# pgrep, pkill - find or signal processes by name and other attributes
#
# SYNOPSIS
# pgrep [-glpfao] pattern
# pkill [-glpfao] [-s SIG] pattern
#
# DESCRIPTION