Skip to content

Instantly share code, notes, and snippets.

View amnonkhen's full-sized avatar

Amnon Khen amnonkhen

View GitHub Profile
@sio
sio / Makefile
Last active January 27, 2022 21:21
Files used in Makefile.venv demo (https://asciinema.org/a/279646)
hello: venv
$(VENV)/python hello.py
include Makefile.venv
Makefile.venv:
curl \
-o Makefile.fetched \
-L "https://github.com/sio/Makefile.venv/raw/v2019.11.06/Makefile.venv"
echo "d32b54ae7cb0e99ec75cff9c4ef78c7050bc0c351f834464674fe4aa328ca370 *Makefile.fetched" \
| sha256sum --check - \
@caroso1222
caroso1222 / dom.service.ts
Last active August 18, 2023 13:34
Service to dynamically append Angular components to the body
import {
Injectable,
Injector,
ComponentFactoryResolver,
EmbeddedViewRef,
ApplicationRef
} from '@angular/core';
@Injectable()
export class DomService {
@nigelkerr
nigelkerr / hocr.js
Created November 6, 2016 19:44
js to include in a hocr file to make it easier to see the document regions recognized
$( document ).ready(function() {
var bbox_re = /bbox (\d+) (\d+) (\d+) (\d+)/i;
var posr = function(i) {
var t = $(this).attr('title');
var result = t.match(bbox_re);
if ( result ) {
var top = result[2] / 3;
var left = result[1] / 3;
@gre
gre / README.md
Last active January 14, 2019 22:41
Standalone minimal version of Google Photos Albums list in order for you to share photos with family and with link to multiple shared google photos albums

DWTFYW

Disclaimer:

  • no warranty this will work for you!
  • I'm not responsible of how you use this!
  • READ, VERIFY and TEST the CODE before using!
@evanwill
evanwill / gitBash_windows.md
Last active April 22, 2024 12:46
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@ThomasR
ThomasR / PowerShell.xml
Created March 21, 2016 20:23
Syntax Highlighting for PowerShell scripts in IntelliJ IDEA
<filetype binary="false" description="PowerShell" name="PowerShell">
<highlighting>
<options>
<option name="LINE_COMMENT" value="#" />
<option name="COMMENT_START" value="&lt;#" />
<option name="COMMENT_END" value="#&gt;" />
<option name="HEX_PREFIX" value="" />
<option name="NUM_POSTFIXES" value="" />
<option name="HAS_BRACES" value="true" />
<option name="HAS_BRACKETS" value="true" />
@itzg
itzg / 0_AddingPersistentVirtualDiskToBoot2Docker.md
Last active February 22, 2021 01:21
Manually adding persistent storage to a VirtualBox VM of boot2docker

These instructions build on those provided here and here.

Before doing the following, create a new virtual disk and attach it to your VM. The size of the virtual disk just depends on what you intend to use/run and how many containers you intend to run. The default, 8 GB, is probably more than enough and is reasonable to use if in doubt since the default mode dynamically allocates the drive as needed.

Boot the VM and run just

fdisk -l

To see the disk device name(s) and their size. In this case it's the /dev/sda shown here that has 8 GB capacity:

@simonw
simonw / gist:7000493
Created October 15, 2013 23:53
How to use custom Python JSON serializers and deserializers to automatically roundtrip complex types.
import json, datetime
class RoundTripEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, obj):
if isinstance(obj, datetime.datetime):
return {
"_type": "datetime",
"value": obj.strftime("%s %s" % (
@carlspring
carlspring / gist:6762356
Last active September 27, 2023 04:02
TeamCity REST API Commands
@andresgutgon
andresgutgon / dosbatch.sublime-build
Created October 29, 2012 15:12 — forked from mmuell/dosbatch.sublime-build
Batch File Running for Sublime Text 2
{
"cmd": ["$file"],
"working_dir": "$file_path",
"selector": "source.dosbatch"
}