Skip to content

Instantly share code, notes, and snippets.

View adadesions's full-sized avatar
:octocat:
Applied Computer Scientist is the gem of the Earth.

Ada Kaminkure adadesions

:octocat:
Applied Computer Scientist is the gem of the Earth.
View GitHub Profile
#include <stdio.h>
int main(){
printf("Hello, C");
return 0;
}
@adadesions
adadesions / SimpleDiffParallel.cpp
Last active May 26, 2017 14:28
Using with openMP
#include <omp.h>
#include <iostream>
#include <vector>
using namespace std;
double f( double x ){
return x*x+1; // x^2 + 1
}
@adadesions
adadesions / FastFibonacci.cpp
Last active September 3, 2017 13:13
Fibonacci calculation in n times
long fastFibo( int n ){
double root5 = std::sqrt(5);
double phi = pow( (1+root5)/2, n+1 );
double tau = pow( (1-root5)/2, n+1 );
long nth = ( phi - tau )/root5;
return nth;
}
<head>
<title> Ada's hack </title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script>
$(document).ready(function(){
$('#btn-login').click(function(){
var username = $('#loginUsername').val();
var password = $('#loginPassword').val();
$('#result').text("Username = "+username+" Password = "+password);
console.log(username);
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 12345678
@adadesions
adadesions / gunicorn_service.sh
Last active November 28, 2017 11:00
Reload Gunicorn
ps aux |grep gunicorn |grep projectname | awk '{ print $2 }' |xargs kill -HUP
@adadesions
adadesions / django_cmd.sh
Created January 5, 2018 06:30 — forked from hezhao/django_cmd.sh
Django Commands Cheatsheet
# Use Python 3 for easy unicode
$ virtualenv -p python3 .env
$ source .env/bin/activate
$ pip install django
$ deactivate
# Start new django project and app
$ django-admin.py startproject mysite
$ ./manage.py migrate
$ ./manage.py createsuperuser

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@adadesions
adadesions / Fix-IPv6
Last active March 8, 2018 13:40
Fix apt-get update get stuck because of IPv6 disable just add those lines below in /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
@adadesions
adadesions / how-to-install-latest-gcc-on-ubuntu-lts.txt
Created March 8, 2018 18:27 — forked from application2000/how-to-install-latest-gcc-on-ubuntu-lts.txt
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \