Skip to content

Instantly share code, notes, and snippets.

@nejckorasa
nejckorasa / deploy_jar.sh
Last active July 5, 2018 13:20
Simple script to deploy JAR files via SCP. Also option to restart them if they are build as Spring Boot Service
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
usage="usage: $(basename "$0") [-h] [-r] [-s] [-t] -n name
options:
-n name Name of JAR (including .jar extension)
-r restart Restart jar once deployed
-t target Set target, for instance demo1
-s SSH target Set SSH target, for instance -s usr@my_host -t /home/usr/remote/dir/path
-h [help]
@arkokoley
arkokoley / star.py
Created February 28, 2018 18:08
Auto star repo in github
'''
Author: Gaurav Koley ([email protected])
'''
import requests
import sys
from requests.auth import HTTPBasicAuth
username = raw_input("username: ")
password = raw_input("password: ")
@posener
posener / go-shebang-story.md
Last active December 31, 2025 16:17
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@drdrang
drdrang / Purge Old Reminders.scpt
Last active April 18, 2025 17:07
AppleScript to delete all reminders more than 30 days old.
set remindersOpen to application "Reminders" is running
set monthAgo to (current date) - (30 * days)
tell application "Reminders"
set myLists to name of every list
repeat with thisList in myLists
tell list thisList
delete (every reminder whose completion date is less than monthAgo)
end tell
end repeat
@udalov
udalov / getKType.kt
Last active March 16, 2021 21:54
DEPRECATED example how to obtain KType instance from reified T. Please use "typeOf" since 1.3.40!
import java.lang.reflect.*
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.KTypeProjection
import kotlin.reflect.KVariance
import kotlin.reflect.full.createType
// --- Interface ---
inline fun <reified T : Any> getKType(): KType =
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active December 24, 2025 06:08
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on