Skip to content

Instantly share code, notes, and snippets.

View bitroniq's full-sized avatar

Piotr Kowalski bitroniq

View GitHub Profile
@sukharevd
sukharevd / aws-s3-gzip-compression.py
Last active February 14, 2024 10:43
Synchronizes directory with gzipped content of Amazon S3 bucket with local one to avoid redundant synchronization requests when files were not changed, but MD5 sums of Gzipped files are different.
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
AWS S3 Gzip compression utility
Author: Dmitriy Sukharev
Modified: 2013-09-11
-------
Synchronizes directory with gzipped content of Amazon S3 bucket with local
@lemiorhan
lemiorhan / post-receive
Last active February 8, 2023 10:06
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@fgassert
fgassert / ec2-get-security-credentials
Last active March 18, 2020 01:27
gets iam security credentials from instance metadata and writes them to awscli environment variables and .s3cfg (for s3cmd)
#!/bin/bash
# gets iam security credentials from instance metadata and writes them to
# awscli environment variables and .s3cfg (for s3cmd)
# Usage: ec2-get-security-credentials ROLENAME DEFAULT_REGION
# ROLE=$1
# DEFAULT_REGION=$2
@juanluisrp
juanluisrp / centos-openstack-post-install-script
Created January 9, 2015 15:01
Openstack post installation script to set a password for root and cloud-user on CentOS
#cloud-config
chpasswd:
list: |
root:stackops
cloud-user:stackops
expire: False
ssh_pwauth: True
@mence
mence / README.md
Created May 8, 2015 20:28
Making the RescueTime Chrome Extension correctly report website usage in Chromium

Making the RescueTime extension work in Chromium

By default, the RescueTime Chrome extension doesn't report exact site usage because the extension determines browser usage by parsing the User Agent string in the request. So we need to fool the extension into thinking that we're using Chrome, not Chromium, which means it will accurately report usage statistics to RescueTime.

  1. Determine the extension's ID by visiting chrome://extensions
  2. If you have not done so before, check Developer mode in the top right.
  3. Locate the id of the RescueTime extension. It will look something like this: ID: bdakmnplckeopfghnlpocafcepegjeap
  4. Navigate to the Chromium extensions location on your machine: ~/Library/Application Support/Chromium/Default/Extensions/{extension_id}/3.0.18_0
  5. Edit RescueTimeUtil.js to return the browser as being Chrome. See the example in RescueTimeUtil.js in this gist.
@mrliptontea
mrliptontea / sublime-text-3-windows-shortcuts.md
Last active March 30, 2024 04:14 — forked from TheShrike/gist:6111200
Sublime Text 3 - Useful Shortcuts (Windows)

Sublime Text 3 - Useful Shortcuts (Windows)

General

Shortcut Description
Ctrl+Shift+P command prompt
Ctrl+Alt+P switch project
Ctrl+P go to file
Ctrl+G go to line
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 31, 2024 07:07
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@joepie91
joepie91 / vpn.md
Last active June 1, 2024 12:47
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@kburdett
kburdett / rpi_unifi.md
Last active March 24, 2022 19:51
Install Ubiquiti's UniFi Controller on a Raspberry Pi

Compatibility

I currently run Ubiquiti's UniFi Controller on a Raspberry Pi 3B without issue. I have tried with a Raspberry Pi 1B, but the application crashes on startup. I assume it is due to a lack of RAM. Presumably, it would run on a Raspberry Pi 2B as well (same amount of RAM), but I have not tested it on this model. YMMV.

Instructions

  1. Install Raspbian on a SD card. I tested this with Jessie Lite (headless)

  2. Use raspi-config to expand the filesystem, rename your PI, etc

@gbaman
gbaman / HowToOTG.md
Last active May 16, 2024 20:10
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int