Skip to content

Instantly share code, notes, and snippets.

@kmassada
kmassada / dec toHex.scm
Last active August 29, 2015 14:02
decimal to hex
(define (toHex dec)
;local-function:solveHex
(define (solveHex dec res)
(let ((base 16))
(cond
[(null? dec) res]
[(>= dec (- base 1)) (solveHex (quotient dec base) (string-append (getHex (remainder dec base)) res) )]
[else (string-append (getHex dec) res)]
)
)
@kmassada
kmassada / linux-wifi-connect
Last active August 29, 2015 14:15
linux connect wifi command
#attempt 2
sudo iwlist wlan0 scan
sudo iwconfig wlan0 essid $WIFI key $KEY
sudo dhclient wlan0
@kmassada
kmassada / ssh-key-setup.sh
Last active February 13, 2023 10:53
Quick setup for ssh, and ssh config file
# set the variables
SSH_HOST="gitlab.com"
SSH_USER=`whoami`
SSH_PORT=22
# create folder with the correct permissions
mkdir -p ~/.ssh/;
chmod 700 ~/.ssh/;
# generate key with u2f/fido
@kmassada
kmassada / sql-create-db-user
Created April 15, 2015 14:47
Create sql database and user
SITE="laravel"
USER="dev"
cat >> $SITE-setup.sql << EOF
CREATE DATABASE ${SITE};
GRANT ALL PRIVILEGES ON ${SITE}.* TO '${USER}'@'localhost' identified by '';
FLUSH PRIVILEGES;
EOF
mysql -u root -p < $SITE-setup.sql
@kmassada
kmassada / mongo-user-setup
Last active August 29, 2015 14:21 — forked from tamoyal/gist:10441108
Mongo User setup
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@kmassada
kmassada / centos7-lamp-bootstrap
Last active March 7, 2018 21:02
centos7 LAMP bootstrap [vagrant]
#!/usr/bin/env bash
# centos7-mamp-bootstrap.sh
# this is an end to end LAMP setup on Centos7.
# this was originally written for Bootsrap.sh on Vagrant
#DATABASE_PW: root password to you db
DATABASE_PW=''
#DOMAIN: name of domain, used for ServerName in Apache
@kmassada
kmassada / centons7-elasticsearch-install
Last active August 29, 2015 14:23
installing elastic search centos7
#!/usr/bin/env bash
echo ">>> Installing Elasticsearch"
cd /opt
sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jre-8u40-linux-x64.tar.gz"
sudo tar xvf jre-8*.tar.gz
@kmassada
kmassada / Homestead.yml
Created September 7, 2015 15:02
Homestead config
---
ip: "192.168.33.11"
memory: 2048
cpus: 1
hostname: laravel5-dev
name: laravel5-dev
provider: virtualbox
authorize: .homestead/homestead@laravel5.dev.pub
@kmassada
kmassada / gulpfile-basic-laravel.js
Created September 9, 2015 15:10
gulpfile-basic-laravel.js
/*
|----------------------------------------------------------------
| Have a Drink!
|----------------------------------------------------------------
|
*/
// --- INIT
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'), // compiles sass to CSS
angular
.module('storageModule', [])
.factory('store',['$window', function($window){
return {
setLocal: function( key, value ){
try{
if( $window.Storage ){
$window.localStorage.setItem(key, value);
return true;
} else {