Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Joseph Kariuki jkariukidev

🏠
Working from home
View GitHub Profile
View reverse_int.py
# Given an integer, return the integer with reversed digits.
# Note: The integer could be either positive or negative.
def solution(x):
string = str(x)
if string[0] == '-':
return int('-'+string[:0:-1])
else:
return int(string[::-1])
@ssaurel
ssaurel / MainActivity.java
Created Aug 22, 2018
Main Activity for the GPS Tutorial on the SSaurel's Blog
View MainActivity.java
package com.ssaurel.fusedlocation;
import android.Manifest;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
View remove-all-from-docker.sh
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@santisbon
santisbon / Update-branch.md
Last active Feb 15, 2022
Deploying from Git branches adds flexibility. Bring your feature branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.
View Update-branch.md

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

@dlebech
dlebech / uwsgi-emperor
Created Feb 2, 2015
uWSGI start/stop script that can be added to /etc/init.d on Ubuntu Linux and used with "sudo service uwsgi-emperor start"
View uwsgi-emperor
#!/usr/bin/env bash
### BEGIN INIT INFO
# Provides: uwsgi-emperor
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the uwsgi emperor app server
# Description: starts uwsgi emperor app server using start-stop-daemon
@lovesh
lovesh / admin.py
Last active Nov 7, 2019
django-admin register all models
View admin.py
"""
Here models are in different modules and the models.py imports them from different modules like this
from model1 import * # or the name of models you want to import
from model2 import User
or you might write all your models in models.py
"""
@thanhleviet
thanhleviet / geoserver.conf
Created Jul 3, 2012
Setting up proxy for geoserver with nginx
View geoserver.conf
Tested on nginx version 1.1.9, ubuntu 12.04
-Command lines in order:
sudo touch /etc/nginx/site-availables/geoserver.conf
sudo vi /etc/nginx/site-availables/geoserver.conf
sudo ln -s /etc/nginx/site-availables/geoserver.conf /etc/nginx/site-enabled/geoserver.conf
sudo service nginx start
Content of geoserver.conf
server {