Skip to content

Instantly share code, notes, and snippets.

View neofreko's full-sized avatar

Akhmad Fathonih neofreko

View GitHub Profile
@maxim5
maxim5 / pretrained_word2vec_lstm_gen.py
Last active July 2, 2023 10:40
Text generator based on LSTM model with pre-trained Word2Vec embeddings in Keras
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
__author__ = 'maxim'
import numpy as np
import gensim
import string
@mugifly
mugifly / adb-android-disable-animation.sh
Last active December 8, 2022 22:40
Disable the animation of Android Virtual Device using adb command
# For Android JellyBean and newer device
adb shell content update --uri content://settings/system --bind value:s:0.0 --where 'name="window_animation_scale"'
adb shell content update --uri content://settings/system --bind value:s:0.0 --where 'name="transition_animation_scale"'
adb shell content update --uri content://settings/system --bind value:s:0.0 --where 'name="animator_duration_scale"'
# For Android ICS and older device
adb shell "echo \"update system set value=0.0 where name='window_animation_scale';\" | sqlite3 /data/data/com.android.providers.settings/databases/settings.db"
adb shell "echo \"update system set value=0.0 where name='transition_animation_scale';\" | sqlite3 /data/data/com.android.providers.settings/databases/settings.db"
@remojansen
remojansen / class_decorator.ts
Last active September 14, 2023 14:54
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@RickyCook
RickyCook / Command.md
Last active November 7, 2023 06:55
Using socat to forward new ports via STDIO in a running Docker container

What?... Why?

Imagine you're messing around in a container, and you install some stuff, add some config, and now it's time to load up your client and check it out! Oh wait, you forgot to forward ports when you created the container! Fear not, all is not lost, for in the world of pipes, and streams, there is always a way to do something disgusting.

The Dockerfile

Example Dockerfile included will install Nginx, and socat in a container, and make Nginx run in foreground mode. To build, and run:

@andrealbinop
andrealbinop / setup-modernie-vagrant-boxes.md
Last active May 28, 2023 01:54
Setup modern.ie vagrant boxes

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites

@ofstudio
ofstudio / get_password.sh
Created December 14, 2014 16:39
Get password from OS X Keychain shell / bash function
# Get password from OS X Keychain function
# Replace %ACCOUNT_NAME% with account name of Keychain item
# See `man security` for more info
get_pw () {
security 2>&1 >/dev/null find-generic-password -ga "%ACCOUNT_NAME%" \
| sed 's/password: "\(.*\)"/\1/'
}
# Don't store server credentials in plain text!
PASS=$(get_pw)

How to combine AWS Elastic Beanstalk, Docker and AWS CloudFormation

Introduction

This text explains how to create and deploy a Docker-based AWS Elastic Beanstalk site and how to control it using CloudFormation.

Please find the CloudFormation template at the end of this Gist.

We assume that you are familiar with AWS ElasticBeanstalk, AWS CloudFormation and Docker.

@zircote
zircote / nginx-marathon.py
Last active November 12, 2015 19:01
Marathon Config writer for NGINX
from jinja2 import Template
import json
import httplib2
import argparse
TEMPLATE = """
user www-data;
worker_processes 4;
pid /run/nginx.pid;
daemon off;
@seenmyfate
seenmyfate / Capfile
Created April 23, 2014 07:55
Capistrano v3 custom Submodule Strategy example
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/scm'
require 'capistrano/git'
class Capistrano::Git < Capistrano::SCM
module SubmoduleStrategy
include DefaultStrategy
def release
@akimboyko
akimboyko / FsCheckSamples.fsx
Last active March 27, 2019 08:04
Samples for Property-based testing using FsCheck for F# and C# talk for Kiev Alt.NET
#I @".\packages\FsCheck.0.9.2.0\lib\net40-Client\"
#r @"FsCheck.dll"
// #time "on"
open FsCheck
// simple example
let revRevIsOrig (xs:list<int>) = List.rev(List.rev xs) = xs
Check.Quick revRevIsOrig;;