This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Online C++ compiler to run C++ program online | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
vector<string> sol(long n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "USAGE:" | |
echo "" | |
echo "yaml2json.sh file.yaml" | |
echo "" | |
echo "it will generate the file.yaml.json" | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$numbers = \range(0, 100000); | |
$result = []; | |
$start = \microtime(true); | |
foreach ($numbers as $number) { | |
$result[] = $number * 10; | |
} | |
$end = \microtime(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val input2 = | |
""" | |
|Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum viverra sit amet ligula id imperdiet. Proin vestibulum eget tellus in viverra. Mauris eleifend malesuada nunc, non porta quam placerat non. Nunc viverra, quam ac varius posuere, sapien tortor elementum nibh, a pulvinar mi nulla vitae lorem. Duis diam dolor, luctus ut suscipit eu, sodales in est. Maecenas egestas at velit eleifend laoreet. Aliquam imperdiet lorem et dolor finibus laoreet vel et lectus. Duis finibus felis eu tempus consectetur. Quisque vestibulum metus sed pretium consequat. Sed non quam faucibus, fringilla mi vel, porttitor metus. | |
| | |
|Nulla tortor est, dignissim nec orci sit amet, vulputate commodo libero. Integer gravida non turpis malesuada fermentum. Pellentesque sollicitudin sem sed lobortis elementum. Phasellus nec est metus. Integer id vehicula velit, sit amet scelerisque tortor. Nullam fermentum ultricies sodales. Duis vitae elementum diam, sit amet dictum nulla. Cras eu velit aliquam, ven |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cmnd_Alias VAGRANT_EXPORTS_CHOWN = /bin/chown 0\:0 /tmp/* | |
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports | |
Cmnd_Alias VAGRANT_EXPORTS_MV = /bin/mv -f /tmp/* /etc/exports | |
Cmnd_Alias VAGRANT_NFSD_CHECK = /usr/bin/systemctl status --no-pager nfs-server.service | |
Cmnd_Alias VAGRANT_NFSD_START = /usr/bin/systemctl start nfs-server.service | |
Cmnd_Alias VAGRANT_NFSD_APPLY = /usr/sbin/exportfs -ar | |
Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp home/rbertini/.vagrant.d/tmp/hosts.local /etc/hosts | |
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /bin/sed -r -e * d -ibak /*/exports | |
Cmnd_Alias VAGRANT_EXPORTS_REMOVE_2 = /bin/cp /*/exports /etc/exports | |
%wheel ALL=(root) NOPASSWD: VAGRANT_EXPORTS_CHOWN, VAGRANT_EXPORTS_ADD, VAGRANT_EXPORTS_MV, VAGRANT_NFSD_CHECK, VAGRANT_NFSD_START, VAGRANT_NFSD_APPLY, VAGRANT_HOSTMANAGER_UPDATE, VAGRANT_EXPORTS_REMOVE, VAGRANT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1 to 100).map { x => | |
val str = StringBuilder.newBuilder | |
if(x % 3 == 0) str append "Fizz" | |
if(x % 5 == 0) str append "Buzz" | |
if(str.size > 0) str.toString else x.toString | |
}.mkString("\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// parameters, set them properly based on your needs. | |
$host = ''; | |
$username = ''; | |
$password = ''; | |
$query = 'select * from [table] limit 0'; | |
$c = mysql_connect($host, $username, $password); | |
$r = mysql_query($query, $c); | |
$n = mysql_num_fields($r); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ssh -fNL $target_port:$target_host:$source_port $source_host |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reverseInt(x: Int): Int = { | |
x.toString.reverse.toInt | |
} | |
def palindromeNumberEquation(x:Int, y:Int): Boolean = { | |
reverseInt(x) == x*y | |
} | |
def differentDigitsInt(x: Int, y: Int): Boolean = { | |
x.toString.groupBy(c => c).map(m => m._2.length).sum == y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo find /var/log/ -name "*.log.*" -exec rm -v {} \; |
NewerOlder