Skip to content

Instantly share code, notes, and snippets.

View chew-z's full-sized avatar

Robert J. chew-z

  • Warsaw, Poland
View GitHub Profile
// Uses the default AWS SDK Credentials; e.g. via the environment
// AWS_REGION=region AWS_ACCESS_KEY_ID=key AWS_SECRET_ACCESS_KEY=secret
package main
import (
"bytes"
"flag"
"fmt"
"io"
"log"
@mpeven
mpeven / setup.sh
Last active July 21, 2017 07:34
Pi3 Hotspot Huawei-in WiFi-out
# This version:
# brings WiFi in from the Huawei adapter on eth1
# pushes WiFi out from the built in adapter on wlan0
# sets up an ip address on 192.168.5.2 to ssh into from another computer
##################################################
# Update
#
#sudo apt-get update
#sudo apt-get -qq upgrade
@cpjhenry
cpjhenry / Send to Notes
Last active October 21, 2016 00:19
AppleScript to send current url from Google Chrome to Mac Notes
on run {input, parameters}
tell application "Google Chrome"
set noteTitle to get title of active tab of first window
set noteURL to get URL of active tab of first window
if noteTitle is "" then
display dialog "Enter a title for the new note:" ¬
with title "Send to Notes" ¬
default answer "Untitled note"
@tuxlinuxien
tuxlinuxien / oauth2_integration.go
Last active October 18, 2023 10:50
gin gonic oauth2 integration
package main
import (
"bytes"
"encoding/json"
"github.com/gin-gonic/gin"
"golang.org/x/oauth2"
"golang.org/x/oauth2/bitbucket"
"golang.org/x/oauth2/github"
"golang.org/x/oauth2/google"
@nguyendangminh
nguyendangminh / favicon.ico.go
Last active February 23, 2025 02:33
Serve favicon.ico in Golang
...
func faviconHandler(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "relative/path/to/favicon.ico")
}
...
func main() {
http.HandleFunc("/favicon.ico", faviconHandler)
}
local char_to_hex = function(c)
return string.format("%%%02X", string.byte(c))
end
local function urlencode(url)
if url == nil then
return
end
url = url:gsub("\n", "\r\n")
url = url:gsub("([^%w ])", char_to_hex)
@subfuzion
subfuzion / curl.md
Last active May 12, 2025 12:24
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@serayuzgur
serayuzgur / Evernote2Notes.scpt
Created October 20, 2015 08:10
Exports from Evernote imports to Apple Notes iCloud Account.
tell application "Evernote"
set _Notebooks to every notebook
repeat with _NoteBook in _Notebooks
set _NoteBookName to name of _NoteBook
set _Notes to every note of _NoteBook
#!/usr/bin/env python
# easyIMAP2Notes (C)2015 by Jan-Piet Mens
# Connect to an IMAP mailbox, read messages, and convert them into
# a format suitable for iOS/OSX Notes, then store them in Notes/
#
# This uses two connections (consider that a feature b/c you can
# slurp from one IMAP account into another). The real reason is I
# couldn't be bothered to implement message decoding/attachment
# extraction with imaplib, so I chose easyimap (pip install easyimap)
# to do that.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# addnote.py by JP Mens (September 2015), inspired by Martin Schmitt
# Usage: addnote subject "body (may be empty") [image ...]
# Adds a Notes.app (OSX and iOS) compatible message to the "Notes"
# IMAP folder. The IMAP store is configured from a file called
# `creds':
#
# [imap]
# hostname =