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
| // https://projecteuler.net/problem=1 | |
| var getSumOfMuliples = function (n1,n2,limit){ | |
| var result=0; | |
| for(var i=Math.min(n1,n2);i<limit;i++){ | |
| if(i%n1==0||i%n2==0){ | |
| result+=i; | |
| } | |
| } | |
| return result; | |
| } |
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
| require 'securerandom' | |
| def get_ips ips_file | |
| content="" | |
| File.open(ips_file,"r") {|file| content = file.read } | |
| result="" | |
| content.scan(/(((([0-9]{1,3}\.){3}[0-9])|(([0-9a-f]{1,4}\:){3}\:))\/[0-9]{2})/) { |match| result += "#{match[0]}\n" } | |
| File.open("#{ips_file}-#{SecureRandom.uuid}.txt","w") {|file| file.write(result)} | |
| end | |
| get_ips ARGV[0] |
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
| Array.prototype.unShift = function (){ | |
| let newArray = [...arguments], i = 0, len = this.length , newArrLength=newArray.length; | |
| for(i; i < len; i++){ | |
| newArray[newArrLength+i] = this[i]; | |
| } | |
| return newArray; | |
| } | |
| let arr =[1,2]; |
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 | |
| last_video=$(find ~/Downloads -type f -regex ".*\.\(mp4\|mkv\|rmvb\|vob\|flv\|mov\|avi\)$" -printf "%-.22T+ %M %n %-8u %-8g %8s %Tx %.8TX %p\n" | sort | tail -n1 | grep -o "/home.*$" ) | |
| if [ -z "$( pgrep totem )" ]; then | |
| echo "$last_video" | xargs -d "\n" totem & | |
| else | |
| echo "$last_video" | xargs -d "\n" totem | |
| fi |
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 loop dir , parent = Dir.pwd | |
| Dir.entries(dir).each do |e| | |
| if File.directory?(e) && (e!="." && e!="..") | |
| dir_path=File.absolute_path(e ,parent) | |
| puts dir_path | |
| loop dir_path , e | |
| elsif !File.directory?(e) && (e!="." && e!="..") | |
| puts File.absolute_path(e , parent) | |
| end | |
| end |
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 | |
| dir_name=$1 | |
| current_dir=$(pwd) | |
| if [ ! -d $dir_name ];then | |
| echo "not a directory" | |
| exit 1 | |
| fi | |
| function change_encoding () | |
| { | |
| cd $dir_name |
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 | |
| cd ~/Downloads | |
| filetounrar=$(ls ./*.rar -t | head -n1) | |
| function unrarmyfile () | |
| { | |
| rar e "$filetounrar" | |
| } | |
| function userchoose () | |
| { | |
| echo "[r]eplace [q]uit" |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace Algo1 | |
| { | |
| internal class Program |
NewerOlder