Skip to content

Instantly share code, notes, and snippets.

@gitawego
gitawego / termux.sh
Last active October 12, 2020 19:42
termux env preparation
#!/bin/bash
set -e
pkg upgrade -y
pkg install wget curl git nodejs-current vim
#install yarn
curl -o- -L https://yarnpkg.com/install.sh | bash
echo "export PATH=$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" >> ~/.bashrc
. ~/.bashrc
@gitawego
gitawego / install-choco.ps1
Last active December 6, 2017 22:30
chocolate portable behind proxy
$creds = Get-Credential
$username = $creds.GetNetworkCredential().UserName
$password = $creds.GetNetworkCredential().Password
$proxyServer = "https://local/proxy/server"
$webProxy = New-Object System.Net.WebProxy($proxyServer,$true)
$webclient = new-object System.Net.WebClient
$creds = Get-Credential
$webclient.Proxy=$webproxy
$webclient.Proxy.Credentials = $creds
@gitawego
gitawego / .bash_aliases
Last active February 26, 2023 21:11
ubuntu apps
function prime_run_fnc(){
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia $@
}
alias prime-run=prime_run_fnc
@gitawego
gitawego / bson.deserialize.js
Last active September 25, 2017 21:51
bson serialization and deserialization
const BSON = require('bson');
const fs = require('fs');
const bson = new BSON();
const file = './test.bson';
const bf = fs.readFileSync(file);
const len = bf.length;
let bfIdx = 0;
const items = [];
console.log('idx',bfIdx,len);
while(bfIdx < len){
@gitawego
gitawego / angular-tips.md
Last active September 23, 2018 09:35
[Angular Tips] #tips

ngInit in angular 2/4

see on stackoverflow

create your own directive

import { Directive, Input } from '@angular/core';

@Directive({
    selector: '[ngInit]'
})
@gitawego
gitawego / cygwin.bat
Created April 26, 2017 08:28
install cygwin without admin
@ECHO OFF
REM -- Automates cygwin installation
REM -- Based on: https://github.com/rtwolf/auto-cygwin-install
REM -- Based on: https://gist.github.com/wjrogers/1016065
SETLOCAL
REM -- Change to the directory of the executing batch file
CD %~dp0
@gitawego
gitawego / .bashrc
Last active October 19, 2021 19:53
docker helper alias
dockerCleanUp(){
# remove exited containers:
docker ps --filter status=dead --filter status=exited --filter status=created -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
docker volume ls -qf dangling=true | xargs -r docker volume rm
}
@gitawego
gitawego / Dockerfile
Created December 14, 2016 22:58
opensuse 42.2 with java 32bit
FROM opensuse:42.2
WORKDIR /tmp
#http://rpmfind.net/linux/RPM/opensuse/updates/13.2/i586/java-1_8_0-openjdk-headless-1.8.0.111-33.1.i586.html
RUN zypper --non-interactive in compat-32bit && \
zypper --non-interactive install wget && \
wget ftp://rpmfind.net/linux/opensuse/update/13.2/i586/java-1_8_0-openjdk-headless-1.8.0.111-33.1.i586.rpm && \
zypper --non-interactive install java-1_8_0-openjdk-headless-1.8.0.111-33.1.i586.rpm && \
rm -f java-1_8_0-openjdk-headless-1.8.0.111-33.1.i586.rpm
@gitawego
gitawego / cert.sh
Last active August 30, 2016 13:38
generate self signed certificates for docker
#! /bin/bash
SCRIPT_PATH=$(cd "$(dirname "$0")"; pwd);
# HEADS UP! Make sure to use '*' or a valid hostname for the FDQN prompt
CERT_NAME=domain
CERT_ROOT=domainroot
DOMAIN_NAME=domain
FOLDER=${SCRIPT_PATH}/certs/self-signed
CERTS_TMP=certs-tmp
cd ${SCRIPT_PATH}
@gitawego
gitawego / simple-server.java
Last active December 17, 2019 02:56
simple HTTP server in Java
package com.stackoverflow.q3732109;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;