Skip to content

Instantly share code, notes, and snippets.

View tnt's full-sized avatar

Thelonius Kort tnt

  • openthinclient gmbh
  • Dresden, Germany
View GitHub Profile
@tnt
tnt / exclude_t.me.js
Created January 31, 2022 16:02
How to filter out all https://t.me/ urls except for certain channels
urls = ["https://t.me/ueberhauptdenken_351/10466",
"https://t.me/querdenken_351/10466",
"https://t.me/geradedenken_351/10466",
"https://de.rt.com/schweiz/130766-tage-freude-in-sicht-schweiz/",
"https://t.me/qd351/10467"]
rx = /^https:\/\/t.me\/(?!querdenken_351|qd351\/)/
urls.filter((url) => !url.match(rx))
# -> ["https://t.me/querdenken_351/10466", "https://de.rt.com/schweiz/130766-tage-freude-in-sicht-schweiz/", "https://t.me/qd351/10467"]
function ConvertFrom-HereString {
param (
[string]$String=''
)
$CleanString = if ($PSVersionTable.PSEdition -eq 'Core'){
$String
} else {
@tnt
tnt / repair-links.rb
Last active August 9, 2017 10:12
Repairing botched youtube time links in a pry session
GEM
remote: http://rubygems.org/
specs:
charlock_holmes (0.7.3)
creole (0.5.0)
diff-lcs (1.3)
gemojione (3.2.0)
json
github-markdown (0.6.9)
github-markup (1.6.0)
diff --git a/firewalld/tasks/main.yml b/firewalld/tasks/main.yml
index 2387387..d045654 100644
--- a/firewalld/tasks/main.yml
+++ b/firewalld/tasks/main.yml
@@ -1,19 +1,19 @@
---
-- name: Enable/disable firewalld - RedHat
+- name: RedHat | Enable/disable firewalld
service:
name: firewalld
diff --git a/ansible/centos-specifics.sh b/ansible/centos-specifics.sh
new file mode 100644
index 0000000..9a23d57
--- /dev/null
+++ b/ansible/centos-specifics.sh
@@ -0,0 +1,27 @@
+function package_update_cache {
+ local FORCE=$1
+ CU_TIME_FILE=/tmp/yum_last_upd_cch
+ if [ -n "$FORCE" ] || [ ! -f $CU_TIME_FILE ] || [ $(date +%s) -gt $(($(date -r $CU_TIME_FILE +%s) + 3600)) ]; then
diff --git a/ansible/plays/provision.yml b/ansible/plays/provision.yml
index bdc1e20..ed5011e 100644
--- a/ansible/plays/provision.yml
+++ b/ansible/plays/provision.yml
@@ -8,6 +8,9 @@
- role: debops.users
users: yes
users_list:
+ - name: 'www-data'
+ groups:
@tnt
tnt / gist:70b116c72be11dc3cc66
Created February 27, 2015 18:34
gpg 1.4.11 with invalid key ids
vagrant@precise32:~$ gpg --recv-keys 409B6B1796C275362A1703113804BB82D39DC0E3
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
vagrant@precise32:~$ gpg --list-keys
vagrant@precise32:~$ gpg --recv-keys 409B6B1796C275362AFFFF113804BB82D39DC0E3
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
@tnt
tnt / gist:eedaed9a6cc75130b9cb
Last active August 29, 2015 14:16
Strange ansible output of test with partially faked hosts and keys - https://github.com/tnt/ansible-gpg-keys-mod
On precise32 instead of the second (fake) key, the first key is processed again.
UPDATE: Everything works fine with sane key ids (https://gist.github.com/tnt/70b116c72be11dc3cc66)
_____________________________________________________________________________
# gpg_keys_mod_test.yml:
---
- hosts: [ precise32, centos-7 ]
vars:
gpg_key_server_urls:
thelonius@thelonius-VirtualBox:~/dresden-weekly/ansible-rails-example$ ./remote.sh
Using Ansible from /opt/ansible v1.8.2
Setting up Ansible to run out of checkout...
PATH=/opt/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PYTHONPATH=/opt/ansible/lib
MANPATH=/opt/ansible/docs/man:
Remember, you may wish to specify your host file with -i