Posts

Showing posts from February, 2000

Amazon Linux AMI Vs Ubuntu

Answer : Amazon Linux AMI is a red hat based distro so things like the package installer or the tools for service manage are different, and another thing you need to consider is the way of bootstraping, amazon instances are more flexible to do some things in cloudformation in the ubuntu way the best form to do it is with cloudinit https://help.ubuntu.com/community/CloudInit, you need to consider the packages too are multiple packages that not are native supported by Amazon Linux.

Bash Array Join Code Example

Example 1: concat strings inside array bash script List = "A B C D" for I in $List do OUT = ${OUT :+ $OUT } - $I done Example 2: make a join function in bash script arrays function join_by { local d = $1 ; shift ; local f = $1 ; shift ; printf %s " $f " " ${@ / # / $d} " ; }

Arduino Convert Int To String Code Example

Example: int to string arduino String stringOne = "Hello String"; // using a constant String String stringOne = String('a'); // converting a constant char into a String String stringTwo = String("This is a string"); // converting a constant string into a String object String stringOne = String(stringTwo + " with more"); // concatenating two strings String stringOne = String(13); // using a constant integer String stringOne = String(analogRead(0), DEC); // using an int and a base String stringOne = String(45, HEX); // using an int and a base (hexadecimal) String stringOne = String(255, BIN); // using an int and a base (binary) String stringOne = String(millis(), DEC); // using a long and a base String stringOne = String(5.698, 3); // using a float and the decimal places

Changing Team Name That Appears In Stats In CS:GO

Image
Answer : The team names are representative of the groups that you belong to on Steam. In order to change the team name you must belong to any group that has a tag. You can find these groups under the Community section of your Steam Interface. Many public groups are open to join with little hassle. Simply click the join group link on the right hand side. After you sign up to any of these groups you can change your settings in game to the tag you want. In game go to "Settings menu" → "Game Settings" → "Team" → "Steam Group Clan Tag":

Calculate Percentage Between Two Columns In SQL Query As Another Column

Answer : Try this: SELECT availablePlaces, capacity, ROUND(availablePlaces * 100.0 / capacity, 1) AS Percent FROM mytable You have to multiply by 100.0 instead of 100, so as to avoid integer division. Also, you have to use ROUND to round to the first decimal digit. Demo here

Baixar Video Linkedin Code Example

Example: download videos from linkedin #Method 2020 1- Go to the video and right-click next to the video (outside the video) 2- Then click on Inspect and Use Ctrl + F to search for vjs-tech 3- Copy the link that start with https ( without src=" ") 4- Paste it in a new tab Happy Learning! Source: https://www.quora.com/How-can-I-download-videos-from-LinkedIn-Learning

Can I Use Javascript To Dynamically Change A Video's Source?

Answer : Sure, You can set the src attribute on the source element: document.querySelector("#myVideoTag > source").src = "http://example.com/new_url.mp4" Or using jQuery instead of standard DOM methods: $("#myVideoTag > source").attr("src", "http://example.com/new_url.mp4"​​​​)​ Then you need to call the load method on the video element: videoElement.load() I have faced this problem several times and based on previous experience and digging I can suggest these options: replace video tag completely yes, just re-insert <video> element with new sources. It's straightforward, but effective approach. Don't forget to re-initialize event listeners. assign video URL to video.src this I saw a lot in answers here, on stackoverflow, and also in sources on github. var video = document.getElementById('#myVideo'); video.src = newSourceURL; It works, but you cannot provide browser opt

ASP.Net MVC - Read File From HttpPostedFileBase Without Save

Answer : This can be done using httpPostedFileBase class returns the HttpInputStreamObject as per specified here You should convert the stream into byte array and then you can read file content Please refer following link http://msdn.microsoft.com/en-us/library/system.web.httprequest.inputstream.aspx ] Hope this helps UPDATE : The stream that you get from your HTTP call is read-only sequential (non-seekable) and the FileStream is read/write seekable. You will need first to read the entire stream from the HTTP call into a byte array, then create the FileStream from that array. Taken from here // Read bytes from http input stream BinaryReader b = new BinaryReader(file.InputStream); byte[] binData = b.ReadBytes(file.ContentLength); string result = System.Text.Encoding.UTF8.GetString(binData); An alternative is to use StreamReader. public void FunctionName(HttpPostedFileBase file) { string result = new StreamReader(file.InputStream).ReadToEnd(); } A

Can I Have Multiple GitHub Actions Workflow Files?

Answer : You can have multiple files in the .github/workflows folder. All files will be read and run as independent tests. The 'on' parameter on each file will tell when it must be called. Following your idea you could have: dev.workflow.yml - To run some kind of testing maybe (only on dev branch, when push) name: Dev Workflow - Test and check thing on: push: branches: - dev jobs: ... prod.workflow.yml - To build and deploy your project (only on master branch, when a PR is closed) name: Master Workflow - Build and deploy to production on: pull_request: types: closed branches: - master jobs: ... Since this question was asked, GitHub has made a few changes to workflows. They are now written in YAML syntax rather than HCL, and instead of being stored in a .github/main.workflow file, they are stored in a .github/workflows directory. The documentation says that "You must store workflow files" (note the plural) "in the .gith

Python Regex Find + Index Code Example

Example: regex find a word index of all matches import re sentence = input ( "Give me a sentence " ) word = input ( "What word would you like to find " ) for match in re.finditer ( word, sentence ) : print ( match.start ( ) , match.end ( ))

Activate Office 2013 Cmd Code Code Example

Example: cmd code to activate microsoft office 2016 @echo off title Activate Microsoft Office 2016 ALL versions for FREE!&cls&echo ============================================================================&echo #Project: Activating Microsoft software products for FREE without software&echo ============================================================================&echo.&echo #Supported products:&echo - Microsoft Office Standard 2016&echo - Microsoft Office Professional Plus 2016&echo.&echo.&(if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b ..\root\Licenses16\proplusvl_kms*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in ('

Change Minecraft Save Location?

Answer : The Minecraft launcher allows you to change the folder it places your saves in (among other things) via the profile settings. Create a "Minecraft" folder on a shared drive. Make sure you have read/write access to this folder from both Windows and Linux. Start the Minecraft Launcher and click on Installations Hover over the profile you want to change, click on ... , then Edit . Enter the folder on your shared drive in the Box labeled "Game Directory". The game will now place saves , resourcepacks , screenshots and crash-reports (maybe some more folders) in this Directory. Repeat on the other OS. Create a folder called saves somewhere in your shared drive. (eg. D:\Xyz\saves). Move your worlds(if you have any saved) to this folder. Then in Windows, create a symlimk to the folder: Open elevated cmd. Navigate to .minecraft folder: cd %appdata%\.minecraft Delete the saves folder from here. In cmd, type: mklink /D saves <path to saves

Bootstrap 4 Popper.min.js Download Code Example

Example 1: bootstrap 4.1.3 cdn with popper < script src = " https://code.jquery.com/jquery-3.3.1.slim.min.js " integrity = " sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo " crossorigin = " anonymous " > </ script > < script src = " https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js " integrity = " sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49 " crossorigin = " anonymous " > </ script > < script src = " https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js " integrity = " sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy " crossorigin = " anonymous " > </ script > Example 2: bootstrap 4.1.3 cdn with popper < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css

Bootstrap 5 Float Right Code Example

Example 1: float right bootstrap < div class = " float-left " > Float left on all viewport sizes </ div > < br > < div class = " float-right " > Float right on all viewport sizes </ div > < br > < div class = " float-none " > Don't float on all viewport sizes </ div > Example 2: bootstrap align right To aligning div in bootstrap you can use bootstrap classes like 1. float-left 2. float-right 3. float-none < div class = " float-left " > Float left on all viewport sizes </ div > < br > < div class = " float-right " > Float right on all viewport sizes </ div > < br > < div class = " float-none " > Don't float on all viewport sizes </ div > Example 3: bootstrap 5 float right .float-start .float-end .float-none .float-sm-start .float-sm-end .float-sm-none .float-md-start .float-md-end .float-md-none .float-lg-s

Bash Default Value For Variable Code Example

Example 1: assign default value in shell script FOO=${VARIABLE:-default} # If variable not set or null, use default. Example 2: Setting default variable value in bash FOO="${VARIABLE:=default}" # If variable not set or null, set it to default.

Codeply Bootstrap 4 Code Example

Example: bootstrap 4 < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css " integrity = " sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh " crossorigin = " anonymous " >

Assign Static IPs To Tap Clients In PfSense's OpenVPN Server

Answer : Solution 1: After some deep digging I found a bug in pfSense's Redmine tracker. This states that the OpenVPN server is missing the client-config-dir variable. Adding mode server;client-config-dir /var/etc/openvpn-csc; to the advanced server options as well as providing the client specific override ifconfig-push [IP] [netmask] did the trick. Solution 2: Some update from my experience: Valid for pfsense 2.3.2 Missing option "client-config-dir" was fixed. now its good. but now, by default, openvpn server config in pfsense has option "username-as-common-name" So in client specific override in field "Common Name" try to write username instead of the Common Name . if you have problems with assigning static IPs, try to inspect your openvpn server config in "/var/etc/openvpn/server1.conf" for that option. P.S. ifconfig-push option remain the same