Skip to content

Instantly share code, notes, and snippets.

View hanrw's full-sized avatar
🎯
Focusing

itshan hanrw

🎯
Focusing
View GitHub Profile
@hanrw
hanrw / Dockerfile
Created April 7, 2019 09:05 — forked from TooMuchFun/Dockerfile
DeepFaceLab GPU-enabled Dockerfile [Ubuntu 16.04 w/ CUDA v9, CUDNN v7]
# NOTE: nvidia-docker must be enabled on the Docker host
FROM nvidia/cuda:9.0-base-ubuntu16.04
ENV LANG C.UTF-8
# adapted from the official tensorflow docker builds [https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/dockerfiles/dockerfiles/devel-gpu.Dockerfile]
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cuda-command-line-tools-9-0 \
cuda-cublas-9-0 \
@hanrw
hanrw / docker-cleanup-resources.md
Created February 14, 2019 07:49 — forked from bastman/docker-cleanup-resources.md
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

@hanrw
hanrw / curl-cloud-config-props.sh
Created May 20, 2018 09:29 — forked from jeffjohnson9046/curl-cloud-config-props.sh
use curl to check out a Spring Boot applicaion's configuration properties from a Spring Cloud Configuration service
# Occasionally I want to see the application properties that are pulled down from the Spring Cloud Config service that provides
# content to our Spring Boot apps. Since I seem to have to re-discover this every time, I figured I'd write it down to help me
# remember.
#
# Additional docs can be found here: https://cloud.spring.io/spring-cloud-config/single/spring-cloud-config.html
# To see the output in YML format
curl -u {the user name}:{the user password} http://{the domain:port}/{the application name}-{the spring profile name}.yml
# For example:
@hanrw
hanrw / KStream.java
Created March 30, 2018 11:35
KStream
@Bean
public KStream<String, Event> kStreamJson(StreamsBuilder builder) {
KStream<String, Event> stream =
builder.stream(topic, Consumed.with(Serdes.String(), new JsonSerde<>(Event.class)));
stream
.map(((key, value) -> KeyValue.pair(LocalDate.now().toString(), 1L)))
.filter(
(key, msg) -> {
System.out.println("Got a message! key = {}, value = {}" + key + " " + msg);
@hanrw
hanrw / hg stats.txt
Created December 28, 2017 09:35 — forked from aras-p/hg and git snippets and stats.md
hg churn and log cheat sheet
Graph of total commits by month, over last year:
hg churn -f "%Y-%m" -s -c -d "-365"
List of my commits over last year:
hg log -k aras -d "2013-01-01 to 2013-12-31" --template "{short(node)} {user(author)} {firstline(desc)}\n" >mycommits.txt
My lines changed count over last year (takes ages):
# How to install `ipkg` on a Synology DS214
After a couple of days of trying to get `ipkg` woking on my DS214 I found [this article](https://github.com/trepmag/ds213j-optware-bootstrap) by [trepmag](https://github.com/trepmag). It is written for the DS213j, but it’s been working for me and [others](https://github.com/alberthild) for the DS214 too.
I have done some minor changed to clarify some things, but if you are a Linux guy (unlike me) my changes might be of no use to you.
## Guide
1. Setup a project
2. Add groovy SDK support:
https://www.bonusbits.com/wiki/HowTo:Add_Groovy_SDK_to_IntelliJ_IDEA
3. Download http://(yourjenkinsurl)/job/(yourpipelinejob)/pipeline-syntax/gdsl
- this will give you the .gdsl file - download this to the src folder of your project.
4. Finally follow this step - right click on the src folder -> Mark directory as -> Sources Root
@hanrw
hanrw / Jenkins-docker
Created September 26, 2017 12:02
Jenkins build docker.
version: '2'
services:
activemq:
image: rmohr/activemq:5.10.0
volumes:
- /home/hanrenwei/Docker/activemq/conf/activemq.xml:/opt/activemq/conf/activemq.xml
- /home/hanrenwei/Docker/activemq/conf/groups.properties:/opt/activemq/conf/groups.properties
- /home/hanrenwei/Docker/activemq/conf/jetty-realm.properties:/opt/activemq/conf/jetty-realm.properties
- /home/hanrenwei/Docker/activemq/conf/users.properties:/opt/activemq/conf/users.properties
- /home/hanrenwei/Docker/activemq/data:/var/activemq/data
@hanrw
hanrw / gist:cec8342d6cb5efc8bafbbb3bab1a2341
Created July 3, 2017 09:54
registry-docker-compose.yml
version: '2'
services:
registry:
image: registry:2
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt
REGISTRY_HTTP_TLS_KEY: /certs/domain.key
version: '2'
services:
mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: demop@ssword
volumes:
- /home/finnplay/docker/var/lib/mysql:/var/lib/mysql
labels:
o.rancher.scheduler.global: 'true'