Skip to content

Instantly share code, notes, and snippets.

View mrhalix's full-sized avatar
💭
Call me on telegram

SM. Amin Aleahmad mrhalix

💭
Call me on telegram
View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@javierwilson
javierwilson / utmToLatLng.py
Created March 30, 2012 17:44
Converts UTM to Latitude, Longitude
#!/usr/bin/python
# taken from http://stackoverflow.com/a/344083/1170404
# usage: cat filemame.txt | ./utmToLatLng.py
import math
import fileinput
# zone = 16 (Nicaragua)
def utmToLatLng(easting, northing, northernHemisphere=True, zone=16):
@jarretgabel
jarretgabel / mobile-redirection-htaccess
Created February 18, 2014 20:36
htaccess mobile redirect
RewriteEngine On
RewriteCond %{QUERY_STRING} !^desktop
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|#opera mobile|palmos|webos" [NC]
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
@mihow
mihow / load_dotenv.sh
Last active July 19, 2024 19:44
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi

Sony Bravia HTTP API

The sony bravia has a HTTP API interacted with using a Pre-Shared key. There's a more complex auth flow but I've not described it here.

There wasn't any documentation, so I've written some. If you're a TV integrator don't read this, you'll laugh. I'm probably just getting confused by UPnP.

Disclaimer: I've only tested this on my TV, which is a KDL-50W829B. Your TV might not have all of the services; see Available services section for how to discover what your TV supports.

@anuragmathur1
anuragmathur1 / add-remove-public-read-s3.txt
Created August 2, 2017 00:00
s3cmd examples to add and remove public-read access for s3 buckets, folders and objects within.
## You may choose to remove --recursive if is required only for the bucket or folder and not for objects within.
s3cmd setacl --acl-private --recursive s3://mybucket-name
s3cmd setacl --acl-private --recursive s3://mybucket-name/folder-name
s3cmd setacl --acl-private --recursive s3://mybucket-name/folder-name/object-name
s3cmd setacl --acl-public --recursive s3://mybucket-name
s3cmd setacl --acl-public --recursive s3://mybucket-name/folder-name
s3cmd setacl --acl-public --recursive s3://mybucket-name/folder-name/object-name
@troyharvey
troyharvey / deployment.yml
Last active July 20, 2024 10:05
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@sdenel
sdenel / nginx-hello-world-deployment.yaml
Last active July 1, 2024 21:07
Kubernetes: a simple Nginx "Hello world" deployment file
# To deploy: kubectl create -f nginx-hello-world-deployment.yaml
# Access it with the API as a proxy:
# $ kubectl proxy
# Then in you browser: http://localhost:8001/api/v1/namespaces/default/services/nginx:/proxy/#!/
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
@kgersen
kgersen / ripe-alloc2db.sh
Created August 9, 2018 13:26
RIPE alloclist to database conversion
#!/bin/bash
# convert RIPE allocation list to database friendly format
# (c) kgersen 2018 for https://lafibre.info
# tab (\t) is used as separator in output
# output
# country ispcode ispname date 4|6 block block_size
# optionnal argument: country code to match
url="https://ftp.ripe.net/ripe/stats/membership/alloclist.txt"
@victorddiniz
victorddiniz / cassadran-reaper-deployment.yaml
Created August 13, 2018 15:59
Cassandra-reaper kubernetes deployment
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: cassandra-reaper
namespace: cassandra-reaper
spec:
template:
metadata:
labels:
app: cassandra-reaper