Skip to content

Instantly share code, notes, and snippets.

View janissl's full-sized avatar

Jānis Šlapiņš janissl

  • Emergn Ltd.
  • Rīga, Latvija
View GitHub Profile
#!/bin/bash
find -type f -name '*.*' -delete
@janissl
janissl / Get-FileCountInDir.ps1
Created April 17, 2019 12:21
Windows PowerShell - Count files in a directory
$filenamePattern = "*.txt"
Get-ChildItem -File -Filter $filenamePattern | Measure-Object | % {$_.Count}
@janissl
janissl / install_cmake_on_linux.sh
Created February 14, 2019 15:57
Linux - Install CMake from source
#!/bin/bash
major=3
minor=13
patch=4
full_ver=${major}.${minor}.${patch}
wget http://www.cmake.org/files/v${major}.${minor}/cmake-${full_ver}.tar.gz
tar xf cmake-${full_ver}.tar.gz
@janissl
janissl / compile_libs.ps1
Created June 21, 2018 14:26
CLD2 - Compile libcld2.dll and libcld2_full.dll on Windows using Powershell
param(
[string]
$CFLAGS,
[string]
$CPPFLAGS,
[string]
$CXXFLAGS,
[string]
$LDFLAGS
)
@janissl
janissl / compile_libs.bat
Last active June 21, 2018 14:27
CLD2 - Compile libcld2.dll and libcld2_full.dll on Windows using Command Prompt
@echo off
:: Prerequisites:
:: - MinGW
:: Can be downloaded from: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds
:: Then select: version (e.g. 8.1.0) > 'threads-win32' > 'seh'
:: - MSYS 1.0
:: Usage example:
:: - Put this batch script into the 'cld2\internal' directory
:: - Using Windows Command Prompt (NOT Powershell!), cd to the 'cld2\internal' directory
@janissl
janissl / unlock_user.md
Last active April 17, 2019 12:51
Oracle - unlock user account

Using SQL Command Line (SQL*Plus), log on as a fully empowered database administrator:
SQL> sqlplus /nolog
SQL> CONNECT SYS as SYSDBA

Get security group ID:
SQL> SELECT workspace_id
FROM apex_workspaces
WHERE workspace = 'INTERNAL'; -- put the actual workspace name

Change the current schema (depends on the installed version):

git checkout master
git merge --no-ff --no-edit dev
git push origin master
git checkout dev
# First modify the size of an EBS volume from the Amazon EC2 Console:
# - Select the volume.
# - Under Actions, select Modify Volume.
# - Enter the new volume size and click Modify.
# - Wait until the volume state icon appears green (may take hours depending on the volume size).
# Refer to https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/console-modify.html for more details.
# Then connect to the Amazon EC2 instance where you have the modified EBS volume attached.
$>lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
@janissl
janissl / detect_language_with_nltk.py
Created April 5, 2018 11:45
Detect the input text language using NLTK
import sys
from nltk.classify.textcat import TextCat
def detect_language(text_string):
return TextCat().guess_language(text_string)
if __name__ == '__main__':
print('ISO 639-3 language code: {}'.format(detect_language(sys.argv[1])))
# Replace 'xvdg' with the actual device name
sudo fsck.ext4 -v /dev/xvdg