Skip to content

Instantly share code, notes, and snippets.

View royki's full-sized avatar
😃
I may be slow to respond.

ROY royki

😃
I may be slow to respond.
View GitHub Profile
@visenger
visenger / install_scala_sbt.sh
Last active January 31, 2023 19:10
Scala and sbt installation on ubuntu 12.04
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update
@julianchurchill
julianchurchill / checkJenkins.sh
Last active December 20, 2022 09:10
A bash script to query a Jenkins server. Use like this: 'checkJenkins.sh <jobname>' and it will query the server with the given job name every 30s. Use like this: 'checkJenkins.sh <jobname> tmux' and it will query the server once and output tmux coloured messages appropriate to display in a tmux status bar. E.g. add this to your .tmux.conf 'set …
#!/bin/bash
CONSOLE_RED="\033[2;31m"
CONSOLE_GREEN="\033[2;32m"
CONSOLE_CLEAR="\033[0m"
JENKINS_SERVER=http://my_jenkins_server
JOB=$1
JOB_QUERY=/job/${JOB}
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 23, 2024 09:14
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)
@osipov
osipov / gist:c2a34884a647c29765ed
Created July 21, 2014 19:12
Install Scala and SBT using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.10.4.deb
sudo dpkg -i scala-2.10.4.deb
sudo apt-get update
sudo apt-get install scala
wget http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.12.4/sbt.deb
sudo dpkg -i sbt.deb
sudo apt-get update
sudo apt-get install sbt
@kmjones1979
kmjones1979 / nginx.conf
Last active July 9, 2024 10:53
Example NGINX configuration to route based on country code using GeoIP
# load dynamic modules
load_module /etc/nginx/modules/ngx_http_geoip_module.so;
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {

Overview

Here you will find instructions for importing the datasets for M001: MongoDB Basics into a locally running MongoDB deployment.

Datasets

All datasets are provided in Amazon S3 in a single zip file (243 MB zipped; 1.5 GB unzipped). The files were created with the mongodump command. They may be imported into your MongoDB deployment using mongorestore. Note that these datasets include the indexes necessary to support example queries and labs used in M001. The datasets included are as follows.

object Solution {
def solution(N: Int): Int = {
if (N < 1) sys.error(s"Invalid input: $N")
@scala.annotation.tailrec
def foo(i: Int, total: Int): (Int, Int) = {
if ((i * i) >= N) (total, i)
else if (N % i == 0) foo(i + 1, total + 2)
else foo(i + 1, total)
}
@royki
royki / usermod.md
Last active November 29, 2020 20:40
Linux Add user in sudo/wheel, Enable root user login

Add user to group and make sudoer/nopassword-access

Ubuntu

  • adduser username
  • usermod -aG groupname username or gpasswd -a user_name group_name
    • usermod -aG sudo username
  • visudo
    • username ALL=(ALL) NOPASSWD:ALL
  • Remove a user from a group
@royki
royki / scp.md
Last active November 29, 2020 19:32
copy commad over ssh

To copy using scp and no password

  • create a folder of own user and become the owner of that folder by chown: folder_name

copy over ssh using scp

  • scp gitlabhq_stag.backup royki@gitlab127.0.0.1.net:/gitlab-data/dump

Copy a Local File to a Remote System with the scp Command

  • scp file.txt royki@10.10.0.2:/remote/directory
  • If SSH on the remote host is listening on a port other than the default 22 then you can specify the port using the -P argument:
    • scp -P 2322 file.txt royki@10.10.0.2:/remote/directory
@royki
royki / terminal.md
Last active November 29, 2020 19:32
Terminal Visible

Button Layout

===================

  • Gnome/Unity/gdm
    • Left -> gsettings set org.gnome.desktop.wm.preferences button-layout 'close,maximize,minimize:'
    • Right -> gsettings set org.gnome.desktop.wm.preferences button-layout ':close,maximize,minimize'
    • gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'

Minimize OnClick Settings

==============================

  • gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'