Skip to content

Instantly share code, notes, and snippets.

View IndrekV's full-sized avatar
🏠
Working from home

Indrek Vändrik IndrekV

🏠
Working from home
View GitHub Profile
@IndrekV
IndrekV / postgres-cheatsheet.md
Created July 15, 2020 05:51 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@IndrekV
IndrekV / mv_fix.txt
Last active June 18, 2020 16:02
Fixes issue with missing -T flag support for mv command in FreeBSD
# mv fix for shipit (replace the missing -T flag in FreeBSD)
mv() {
if [[ $1 == "-fT" ]]; then
rm $3 && command mv -f $2 $3
else
command mv "$@"
fi
}
@IndrekV
IndrekV / ame
Created July 4, 2019 12:21 — forked from yoshinari-nomura/ame
Set your status in Slack with CLI
#!/bin/bash
################################################################
## Usage
usage() {
echo "ame [-c CONFIG_FILE] [-t TEAM] ICON TEXT"
echo " -c Set config file name."
echo " -t Set Slack team name."
echo "examples:"
@IndrekV
IndrekV / repo-rinse.sh
Created January 8, 2019 05:56 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@IndrekV
IndrekV / Virtual Box Host Only Static IP.md
Last active November 27, 2018 10:37 — forked from pjdietz/Virtual Box Host Only Static IP.md
VirtualBox Host-Only Adapter with Static IP (November 2018)

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox:

  • Select "Global Tools" in the top right side of the VirtualBox main window.
  • Go to the "Host Network" selectionstab
  • Add a Host-only Network
  • Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)
@IndrekV
IndrekV / CompleterWithQSqlTableModel.pro
Created August 6, 2018 14:35 — forked from eyllanesc/CompleterWithQSqlTableModel.pro
Example QCompleter with QSqlTableModel
#-------------------------------------------------
#
# Project created by QtCreator 2017-09-17T11:02:01
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets sql
@IndrekV
IndrekV / progamatically-popover-example.m
Created February 1, 2018 13:58 — forked from marteinn/progamatically-popover-example.m
NSPopover Example: Create and show a NSPopover programmatically when a user clicks a button in a subview
-(void) buttonClick:(NSButton *)sender {
// Create view controller
EXPopoverViewController *viewController = [[EXPopoverViewController alloc] init];
// Create popover
NSPopover *entryPopover = [[NSPopover alloc] init];
[entryPopover setContentSize:NSMakeSize(200.0, 200.0)];
[entryPopover setBehavior:NSPopoverBehaviorTransient];
[entryPopover setAnimates:YES];
[entryPopover setContentViewController:viewController];
@IndrekV
IndrekV / index.android.js
Created December 20, 2017 07:29 — forked from tackkinc/index.android.js
React Native - Section ListView with search input
/**
* Inspired by "MyASUS - ASUS support" version 2016 https://play.google.com/store/apps/details?id=com.asus.ia.asusapp
* Colors: https://material.google.com/style/color.html#color-color-palette
*
* See online - https://rnplay.org/apps/7qet3A
*/
import React, { Component, } from 'react';
import {
AppRegistry,
@IndrekV
IndrekV / Main.hx
Created December 6, 2017 12:45 — forked from jgranick/Main.hx
Basic GameCenter Example
package;
import extension.gamecenter.GameCenter;
import extension.gamecenter.GameCenterEvent;
import flash.display.Sprite;
class Main extends Sprite {
@IndrekV
IndrekV / gist:dcf7f6633c29173db7df5da5758a3cb9
Created September 17, 2016 18:45 — forked from anonymous/gist:478997
isometric calculations
var hitArray:Array = new Array();
//we FIRST move the player, then move the player BACKWARD if there's a collision.
player.sprite.x += player.xVelocity;
player.sprite.y += player.yVelocity;
player.sprite.z += player.zVelocity;
// Here, I do a 3D hit test to see the player is touching any of the objects in the scene.
// Those objects are then tested later to see WHERE they touch.