Skip to content

Instantly share code, notes, and snippets.

View bsingr's full-sized avatar

bsingr

View GitHub Profile
@bsingr
bsingr / LICENSE.txt
Last active December 6, 2024 16:54
http json echo server written in python3
Copyright (c) 2016 Jens Bissinger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@bsingr
bsingr / hearts_css3.html
Created April 24, 2011 10:02
Bouncing Hearts CSS3 in HTML/JS/CSS
<!DOCTYPE html>
<html>
<head>
<style type="text/css" media="screen">
* {
overflow: hidden;
font-family: "Helvetica Neue";
cursor: pointer;
text-selection: none;
}
@bsingr
bsingr / demo.yml
Created November 7, 2023 10:23
k8s nginx demo
kind: Namespace
apiVersion: v1
metadata:
name: demo
labels:
name: demo
---
apiVersion: apps/v1
kind: Deployment
metadata:
@bsingr
bsingr / nginx.conf
Last active October 23, 2023 05:46
Shadow traffic duplication reverse proxy
daemon off;
error_log /dev/stderr warn;
worker_processes 4;
events {
worker_connections 1024;
multi_accept on;
}
@bsingr
bsingr / list-queues.sh
Last active October 19, 2023 12:16
rabbitmq remove amq.gen queues
#!/bin/sh
USER=admin
PASS=a
rabbitmqadmin -u "$USER" -p "$PASS" list queues | grep -oP "amq.gen-[\w\-]+"
@bsingr
bsingr / rename-computer-jamf.py
Created October 10, 2023 10:10
rename-computer-jamf.py
#!/usr/bin/env python3
'''
Rename computer from remote CSV using Jamf binary
Pass in the URL to your remote CSV file using script parameter 4
The remote CSV could live on a web server you control, OR be a Google Sheet
specified in the following format:
https://docs.google.com/spreadsheets/u/0/d/<document ID>/export?format=csv&id=<document ID>&gid=0
'''
@bsingr
bsingr / gist:e3ff80534e9e4f7d50ba6b240e932c80
Last active August 25, 2023 16:53 — forked from crittermike/gist:7b654d3d686a4e434eda
Run a single specific Drupal update hook using Drush
drush php-eval "module_load_install('MYMODULE'); MYMODULE_update_NUMBER();"
# or
drush php:cli
require 'core/modules/taxonomy/taxonomy.post_update.php';
taxonomy_post_update_add_unpublished_nodes_to_taxonomy_index($sandbox);
@bsingr
bsingr / 1_simple_to_proc.rb
Created August 19, 2012 11:31
Ampersand tricks in Ruby
#!/usr/bin/env ruby
# Modify all values of an array the same way
# Do you often see code like this?
puts [0.3, 0.5, 0.7].map{|float| float.round} # [0, 1, 1]
# We can do better!
puts [0.3, 0.5, 0.7].map(&:round) # [0, 1, 1]
@bsingr
bsingr / aws_s3_last_modified_buckets.sh
Created July 28, 2023 07:15
aws_s3_last_modified_buckets
#!/bin/bash
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_DEFAULT_REGION=
buckets_wsv=$(aws s3api list-buckets --query "Buckets[].Name" --output text)
echo $buckets_wsv
echo
echo "---"
@bsingr
bsingr / ruby_ipv4_notations.rb
Created November 1, 2011 11:19
Convert Ipv4 Addresses between Integer and dot-decimal notation using ruby
# How to convert IPv4 addresses between integer <=> dot-decimal notation
INTEGER = 1698212032
DOT_DECIMAL = '192.168.56.101'
# [ 192, 168, 56, 101 ]
DOT_DECIMAL_PARTS = DOT_DECIMAL.split('.').map(&:to_i)
####################################
# integer to dot-decimal