Skip to content

Instantly share code, notes, and snippets.

View mrjohannchang's full-sized avatar

Johann Chang mrjohannchang

View GitHub Profile
@nl5887
nl5887 / gpg-agent.conf
Last active November 14, 2022 09:37
Using GPG Agent on OS-X
launchctl unload -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist
launchctl load -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist
@tiwiz
tiwiz / build.gradle
Last active June 12, 2018 19:26
How to make Retrolambda work with both Mac OS X and Windows. Thanks to @Takhion - https://gist.github.com/Takhion/5c0f6c0c5aba9db5a488
import org.gradle.internal.os.OperatingSystem;
String getJavaHome(String version) {
def stdout = new ByteArrayOutputStream()
exec {
commandLine "/usr/libexec/java_home", "-v", version
standardOutput = stdout;
}
return stdout.toString().trim()
}
@cpbotha
cpbotha / pyside_dynamic.py
Last active October 24, 2024 15:24
pyside_dynamic.py with minor improvements - also see http://stackoverflow.com/a/14894550/532513
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Sebastian Wiesner <[email protected]>
# Modifications by Charl Botha <[email protected]>
# * customWidgets support (registerCustomWidget() causes segfault in
# pyside 1.1.2 on Ubuntu 12.04 x86_64)
# * workingDirectory support in loadUi
# found this here:
# https://github.com/lunaryorn/snippets/blob/master/qt4/designer/pyside_dynamic.py
<#
{
"info": {
"Statement": "Code is poetry",
"Author": "Joerg Hochwald",
"Contact": "[email protected]",
"Link": "http://hochwald.net",
"Support": "https://github.com/jhochwald/MyPowerShellStuff/issues"
},
"Copyright": "(c) 2012-2015 by Joerg Hochwald. All rights reserved."
@drmalex07
drmalex07 / README-oneshot-systemd-service.md
Last active July 7, 2024 19:47
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh:

@aviaryan
aviaryan / zsh-on-windows.md
Last active February 9, 2024 03:22
Installing zsh and oh-my-zsh on Windows
  1. Install zsh from cygwin
  2. Install oh-my-zsh from https://github.com/robbyrussell/oh-my-zsh . Follow the manual instructions
  3. To make zsh default on ConEmu, create a task with C:\cygwin64\bin\mintty.exe /usr/bin/zsh - . Make it the defaut shell.
  4. To start a zsh shell on demand, add this batch script to your path or start menu or wherever.
start C:\cygwin64\bin\mintty.exe /usr/bin/zsh -
@btroncone
btroncone / rxjs_operators_by_example.md
Last active March 30, 2025 21:26
RxJS 5 Operators By Example
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

#!/usr/bin/env bash
# echo -e "a\nb\nc\n" | lastln b
function lastln() {
pattern="$1"
i=0
n=-1
while read line; do
if [[ "$line" == "$pattern" ]]; then
n=$i