Skip to content

Instantly share code, notes, and snippets.

View firstval's full-sized avatar
👋

First Val Babon firstval

👋
  • Philippines
View GitHub Profile
import random
random.seed(0)
def MakeData():
Data = ["Spam"] * 5
Data.extend(["Eggs"] * 2)
Data.extend(["Ham"] * 2)
return Data
<?php
/**
* Implements COMMANDFILE_drush_command().
*/
function toolkit_drush_command() {
$items = array();
// Command for Clear Cache All.
// The 'cca' array key is what you type in the terminal, like: drush cca.
# replace these details (also consider using Get-Credential to enter password securely as script runs)..
$username = "SomeUser@SomeOrg.onmicrosoft.com"
$password = "SomePassword"
$url = "https://SomeSite.sharepoint.com"
$securePassword = ConvertTo-SecureString $Password -AsPlainText -Force
# the path here may need to change if you used e.g. C:\Lib..
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

SSL upgrades on rubygems.org and RubyInstaller versions

UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.


Hello,

If you reached this page, means you've hit this SSL error when trying to

@firstval
firstval / install_python.sh
Last active September 21, 2015 08:04 — forked from andriisoldatenko/install_python.sh
Install local Python 2.7.10 on CentOS 7
TMP_PATH=~/tmp_install_python
#Install python3-tk and tk-dev
sudo aptitude install python3-tk
sudo aptitude install tk-dev
# Versions section
PYTHON_MAJOR=2.7
PYTHON_VERSION=$PYTHON_MAJOR.10
mkdir $TMP_PATH && cd $TMP_PATH
@firstval
firstval / azure.txt
Created September 13, 2015 02:38
Create an Azure ROR
#Add this endpoints on Windows Azure
TCP-HTTP-80-80
TCP-Ruby-3000-3000
#Server up
rails server -b 0.0.0.0 -p 80
@firstval
firstval / README.md
Last active September 15, 2015 05:09 — forked from fnichol/README.md
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@firstval
firstval / path_delete
Created September 17, 2015 10:30
Removing PATH on LINUX
So, combining the answers from @gilles and @bruno-a (and a couple of other sed tricks) I came up with this one-liner, which will remove (every) REMOVE_PART from PATH, regardless of whether it occurs at the beginning, middle or end of PATH
PATH=$(REMOVE_PART="/d/Programme/cygwin/bin" sh -c 'echo ":$PATH:" | sed "s@:$REMOVE_PART:@:@g;s@^:\(.*\):\$@\1@"')
It's a bit unwieldy, but it's nice to be able to do it in one hit. The ; is used to join together the two separate sed commands:
s@:$REMOVE_PART:@:@g (which replaces :$REMOVE_PART: with a single :)
s@^:\(.*\):\$@\1@ (which strips off the leading and trailing colons we added with the echo command)
And along similar lines, I've just managed to come up with this one-liner for adding a ADD_PART to the PATH, only if the PATH doesn't already contain it
@firstval
firstval / Git_Installation.sh
Last active September 22, 2022 16:44
Installing Git on CentOS 6.7
yum groupinstall "Development Tools"
yum install gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel expat-devel curl-devel
yum install gcc perl-ExtUtils-MakeMaker
yum remove git
wget https://github.com/git/git/archive/v2.5.3.tar.gz -O git.tar.gz
tar -zxf git.tar.gz
cd git-2.5.3
make configure
./configure --prefix=/usr/local
make install
@firstval
firstval / NTFS_Centos.sh
Created September 21, 2015 09:10
Installing NTFS on CENTOS
rpm -Uvh http://mirror.pregi.net/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y install ntfs-3g