Skip to content

Instantly share code, notes, and snippets.

View danleyb2's full-sized avatar
:octocat:
...

Nyaundi Brian danleyb2

:octocat:
...
View GitHub Profile
@danleyb2
danleyb2 / bitbucket-webhook.php
Created September 13, 2018 13:27 — forked from maztch/bitbucket-webhook.php
A simple php script for deploy using bitbucket webhook
<?php
//edit with your data
$repo_dir = '~/repository.git';
$web_root_dir = '~/project';
$post_script = '~/project/scripts/post_deploy.sh';
$onbranch = 'master';
// A simple php script for deploy using bitbucket webhook
// Remember to use the correct user:group permisions and ssh keys for apache user!!
// Dirs used here must exists on server and have owner permisions to www-data
@danleyb2
danleyb2 / gist:00a3e099fc9292ffe617e6ee7bba78c7
Created September 11, 2018 02:35 — forked from SimonSun1988/gist:2ef7db45e46b889783647d941ec15e4d
解決 Ubuntu "can’t set the locale; make sure $LC_* and $LANG are correct" 的錯誤
## 安裝語系檔
`$ sudo locale-gen "en_US.UTF-8"`
## 重新設定語系檔
`$ sudo dpkg-reconfigure locales`
## 設定檔
@danleyb2
danleyb2 / settings_local.py
Created February 10, 2018 10:05
Danleyb2 Django Local Settings
import os
# Helper settings for prj.settings
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
INSTANCE = '/tmp/mapping_app_instance/'
MEDIA_UPLOAD_ROOT = os.path.join(INSTANCE,'media')
@Singleton
public class DbHelper extends SQLiteOpenHelper {
//USER TABLE
public static final String USER_TABLE_NAME = "users";
public static final String USER_COLUMN_USER_ID = "id";
public static final String USER_COLUMN_USER_NAME = "usr_name";
public static final String USER_COLUMN_USER_ADDRESS = "usr_add";
public static final String USER_COLUMN_USER_CREATED_AT = "created_at";
public static final String USER_COLUMN_USER_UPDATED_AT = "updated_at";
@danleyb2
danleyb2 / cirm.py
Created August 15, 2017 05:20
Plot a given number of equally spaced circumferance cordinates on a x,y center with given radius
import math
from math import pi
def points_on_circumference(center=(0, 0), r=50, n=100):
return [
(
center[0]+(math.cos(2 * pi / n * x) * r), # x
center[1] + (math.sin(2 * pi / n * x) * r) # y

Keybase proof

I hereby claim:

  • I am danleyb2 on github.
  • I am danleyb2 (https://keybase.io/danleyb2) on keybase.
  • I have a public key ASA3TCNVO1kXk46ZlvZ4tMvEflADiA7hkKiHHHEqb8JD7Ao

To claim this, I am signing this object:

[
[
"_m.a.i.c.a_",
1
],
[
"__elibarikidaniel_marando__",
1
],
[
# Show current git branch in prompt.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
LIGHT_GREEN="\[\033[1;32m\]"
LIGHT_GRAY="\[\033[0;37m\]"
L="\[\033[0;35m\]"
<?php
// A simple PHP script demonstrating how to connect to MySQL.
// Press the 'Run' button on the top to start the web server,
// then click the URL that is emitted to the Output tab of the console.
$servername = getenv('IP');
$username = getenv('C9_USER');
$password = "";
$database = "c9";
$dbport = 3306;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.