This file contains 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
<StackPanel Orientation="Horizontal" Margin="20"> | |
<Button Content="Start" Height="20" Command="{Binding StartCommand}" VerticalAlignment="Top" Margin="5" /> | |
<Button Content="Stop" Height="20" Command="{Binding StopCommand}" VerticalAlignment="Top" Margin="5" /> | |
<TextBlock Text="{Binding Status}" Margin="5"> | |
<TextBlock.Style> | |
<Style TargetType="{x:Type TextBlock}"> | |
<Style.Triggers> | |
<DataTrigger Binding="{Binding Status}" Value="Running"> | |
<DataTrigger.EnterActions> | |
<BeginStoryboard Name="animationRefresh"> |
This file contains 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 | |
### | |
# usage: script.sh "magnet_link" | |
### | |
# magnet link should be enclosed in quotes. | |
# Example: | |
# bash /path/to/script.sh "magnet:?xt=urn:btih:8a42938cb7512c1aa722fab7d2e432422d432d9a" |
This file contains 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
//Is Also An Example Of Seeking Beyone Extent Of File. | |
var f = Path.Combine(Application.StartupPath, "temp.log"); | |
File.Delete(f); | |
using (var fs = new FileStream(f, FileMode.Create)) | |
{ | |
fs.Seek(1L * 1024 * 1024 * 1024, SeekOrigin.Begin); | |
fs.WriteByte(0); | |
fs.Close(); | |
} |
This file contains 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
public static string ReadEndTokens(string path, Int64 numberOfTokens, Encoding encoding, string tokenSeparator) | |
{ | |
int sizeOfChar = encoding.GetByteCount("\n"); | |
byte[] buffer = encoding.GetBytes(tokenSeparator); | |
using (FileStream fs = new FileStream(path, FileMode.Open)) | |
{ |
This file contains 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
TransferUtility fileTransferUtility = | |
new TransferUtility( | |
new AmazonS3Client( | |
"ACCESS-KEY-ID", | |
"SECRET-ACCESS-KEY", | |
Amazon.RegionEndpoint.APSouthEast1)); | |
fileTransferUtility.Download(filePath, | |
"my-bucket-name and folder", | |
fileName); |
This file contains 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
function printDiv() | |
{ | |
var divToPrint=document.getElementById('DivIdToPrint'); | |
var newWin=window.open('','Print-Window'); | |
newWin.document.open(); | |
newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>'); | |
newWin.document.close(); | |
setTimeout(function(){newWin.close();},1000); | |
} |
This file contains 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
//Usage : copyStringToClipboard("abc123"); | |
function copyStringToClipboard (str) { | |
// Create new element | |
var el = document.createElement('textarea'); | |
// Set value (string to be copied) | |
el.value = str; | |
// Set non-editable to avoid focus and move outside of view | |
el.setAttribute('readonly', ''); | |
el.style = {position: 'absolute', left: '-9999px'}; |
This file contains 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
[HttpGet("files/{id:int}")] | |
public async Task<ActionResult> DownloadFile(int id) | |
{ | |
var filePath = $"{id}.txt"; // Here, you should validate the request and the existance of the file. | |
var bytes = await System.IO.File.ReadAllBytesAsync(filePath); | |
return File(bytes, "text/plain", Path.GetFileName(filePath)); | |
} |
This file contains 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
#target { | |
height: 100px; | |
border: 1px solid black; | |
margin-top: 50px; | |
} | |
#dummy { | |
display: inline-block; | |
} |
This file contains 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
.shadowbox { | |
padding:10px 60px; | |
-webkit-border-radius: 25px 6px 6px 25px; | |
-moz-border-radius: 25px 6px 6px 25px; | |
border-radius: 25px 6px 6px 25px; | |
background: -moz-linear-gradient(top, #f6e6b4 0%, #ed9017 100%); /* firefox */ | |
border: solid #ccc 3px; | |
box-shadow: 0 1px 2px #fff, 0 -1px 1px #666, inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8); | |
-moz-box-shadow: 0 1px 2px #fff, 0 -1px 1px #666, inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8); | |
-webkit-box-shadow: 0 1px 2px #fff, 0 -1px 1px #666, inset 0 -1px 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8); |