Skip to content

Instantly share code, notes, and snippets.

View mikahanninen's full-sized avatar

Mika Hänninen mikahanninen

  • Robocorp
  • Finland
View GitHub Profile
@abhilater
abhilater / aws.txt
Last active November 19, 2019 11:11
AWS #aws
Install virtualenv using pip.
$ pip install --user virtualenv
Create a virtual environment and name it.
$ virtualenv ~/cli-ve
Alternatively, you can use the -p option to specify a version of Python other than the default.
$ virtualenv -p /usr/bin/python3.4 ~/cli-ve
Activate your new virtual environment.
@rdapaz
rdapaz / win32com.client.py
Last active December 18, 2023 22:50
Fix for module win32com.gen_py has no attribute 'CLSIDToPackageMap'
# If errors are found, do this
# clear contents of C:\Users\<username>\AppData\Local\Temp\gen_py
# that should fix it, to test it type
import win32com.client
app = win32com.client.gencache.EnsureDispatch('Word.Application')
app.Visible = True
@tweitzel
tweitzel / logtemp.sh
Last active November 19, 2019 11:11
log a raspberry pi's cpu temperature to amazon cloudwatch
#!/bin/bash
OUTPUT=$(/usr/bin/vcgencmd measure_temp)
CUTOUT=$(echo ${OUTPUT:5} | cut -f1 -d\')
/var/awslogs/bin/aws cloudwatch put-metric-data --metric-name CPUTemp --namespace hardware --value "$CUTOUT" --timestamp "$(date -Is)" --region us-west-1
@mdonkers
mdonkers / server.py
Last active April 30, 2024 23:26
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@cassiocardoso
cassiocardoso / osx_install.sh
Last active April 8, 2024 00:24 — forked from t-io/osx_install.sh
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@ctrl-freak
ctrl-freak / gist:9abb5aea0d89d7bd9df6a3d0ac08b73c
Created November 2, 2016 01:18
Android ADB `adb shell input keyevent` Codes
// http://stackoverflow.com/questions/7789826/adb-shell-input-events
0 --> "KEYCODE_0"
1 --> "KEYCODE_SOFT_LEFT"
2 --> "KEYCODE_SOFT_RIGHT"
3 --> "KEYCODE_HOME"
4 --> "KEYCODE_BACK"
5 --> "KEYCODE_CALL"
6 --> "KEYCODE_ENDCALL"
7 --> "KEYCODE_0"
@BertrandBordage
BertrandBordage / autoreplyer.py
Last active June 5, 2023 07:03
Automatically reply to unread and unanswered messages in Python
"""
Automatically replies to mails both unread and unanswered.
WARNING: This answers to any both unread and unanswered mail, even if it is years old.
Don’t use on a mailbox with old messages left unread and unanswered.
Simply subclass ``AutoReplyer``, define the undefined class attribute,
and call the ``run`` method on an instance. This loops until you stop the script
(using Ctrl+C, typically) or until an error occurs, like a network failure.
@simonw
simonw / gist:68d19a46e8edc2cd8c68
Last active October 13, 2021 00:04
Fix "Do you want the application "python" to accept incoming network connections?" by code signing the python executable in your virtualenv - copied here in case https://www.darklaunch.com/2014/02/02/fix-do-you-want-the-application-python-to-accept-incoming-network-connections ever goes away.
With the OS X firewall enabled, you can remove the "Do you want the application "python" to accept incoming network connections?" message.
Create a self-signed certificate.
Open Keychain Access. Applications > Utilities > Keychain Access.
Keychain Access menu > Certificate Assistant > Create a Certificate...
Enter a Name like "My Certificate".
Select Identity Type: Self Signed Root
Select Certificate Type: Code Signing
Check the Let me override defaults box

Offline Python Package Install Notes

Two common cases which make the install of Python packages harder due to networking issues are: a) Install behind a Proxy b) Install without access to the internet

(a) Install behind a Proxy

In the case where the target machine connects to the internet over a network proxy, export the following environment vars, as appropriate - http_proxy and https_proxy. Eg:

@ericelliott
ericelliott / essential-javascript-links.md
Last active April 22, 2024 10:15
Essential JavaScript Links