Skip to content

Instantly share code, notes, and snippets.

bicycles and crutches

Anton Markelov strangeman

bicycles and crutches
View GitHub Profile
View upload static to AWS
- name: Generate uniq path
site_tmp_path: "/tmp/npm/{{ ansible_date_time.iso8601_micro | to_uuid }}"
- name: Create a {{ site_tmp_path }} directory if it does not exist
path: '{{ site_tmp_path }}'
state: directory
become: false
strangeman /
Created August 17, 2019 00:32
Remove all issues from Sentry project (need Python 3.7+)
import json
import requests
API_KEY="longrandomstring" # Sentry API key with event:admin scope
ORG_SLUG = "organization" # organization slug
PROJECT_SLUG = "nice-project" # project slug
SENTRY_ROOT = "" # root Sentry URL
BATCH_SIZE = 20 # how many issues deletes by one request (from 1 to 100)
headers = {'Authorization': f'Bearer {API_KEY}'}
strangeman /
Created January 14, 2018 04:42
Vincenty formula for distance calculation (rewritten from
use std::f64;
use std::f64::NAN;
fn vincenty_distance(lat1: f64, lon1: f64, lat2: f64, lon2: f64) -> f64 {
let a: f64 = 6378137.0;
let f: f64 = 1.0/298.257223563;
let b: f64 = 6356752.314245;
let epsilon: f64 = 1e-12;
strangeman / provisionViaSemaphore.groovy
Last active October 7, 2017 18:02
Semaphore API Call Snippet for Jenkins
View provisionViaSemaphore.groovy
echo "DEBUG: got project_id ${project_id} and template_id ${template_id}"
withCredentials([[$class: 'StringBinding', credentialsId: 'semaphore-token', variable: 'bearer']]) {
httpRequest acceptType: 'APPLICATION_JSON', consoleLogResponseBody: true, contentType: 'APPLICATION_JSON', customHeaders: [[name: 'Authorization', value: "Bearer ${env.bearer}"]], httpMode: 'POST', requestBody: """{
\"template_id\": ${template_id},
\"debug\": false,
\"dry_run\": false,
\"playbook\": \"\",
\"environment\": \"\"
}""", url: "${project_id}/tasks"
#!/usr/bin/env python
import sys, string, re, types
import yaml
from xml.dom import minidom
from xml.dom import Node

Keybase proof

I hereby claim:

  • I am strangeman on github.
  • I am strangeman ( on keybase.
  • I have a public key whose fingerprint is 10DB 437A 455A AD17 E086 5AFF 815E C530 5632 CC33

To claim this, I am signing this object:

strangeman /
Created July 15, 2016 05:28
Delete many files from nginx cache
from time import sleep
import os
path = '/var/cache/nginx/client_temp/'
for file_name in xrange(0, 9999999999):
file_path = '/var/cache/nginx/client_temp/'+str(file_name).zfill(10)
print 'trying to delete '+file_path
strangeman /
Created October 7, 2013 23:43
Monitoring Apache
""" Fetch Apache stats via mod_status and send to Zabbix
By Paulson McIntyre
Patches by:
Zach Bailey <>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
strangeman / template_memcache.xml
Created October 7, 2013 23:31
Memcache monitoring
View template_memcache.xml
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export version="1.0" date="09.06.10" time="10.53">
<host name="Template_Memcache">
# Get latest LiteSpeed Web Server stats
# somewhere from zabbix forums
# add to cron:
#* * * * * /etc/zabbix/scripts/ > /dev/null 2>&1
use English '-no_match_vars';