Skip to content

Instantly share code, notes, and snippets.

@espio999
espio999 / screenshot.cs
Last active December 4, 2021 14:15
screenshot of whole screen and active window with .NET Framework
String filename(String val)
{
String my_dir = "d:\\user temp\\20211204\\";
String my_file = DateTime.Now.ToString("hhmmss") + ".jpg";
return (my_dir + val + my_file);
}
Size screen_size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Size window_size = this.Size;
@espio999
espio999 / Capture.cs
Last active December 16, 2021 14:26
Windows screen capture - screen, active window and designated rectangle area
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApp1
{
internal class Capture
{
[StructLayout(LayoutKind.Sequential)]
@espio999
espio999 / KeyHook.cs
Created December 17, 2021 14:28
Hook keyboard event on Windows
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace OnePushSnap
{
internal class KeyHook
{
delegate int delegateHookCallback(int nCode, IntPtr wParam, IntPtr lParam);
@espio999
espio999 / make_daily_folder.ps1
Last active February 11, 2024 11:28
make daily working folder under target drive as" Drive:\%y\%m%d\"
$parent_folder = drive = "d:\" + Get-Date -UFormat %y
$daily_folder = Get-Date -UFormat %m%d
$path = $parent_Frive + $parent_folder + $daily_folder
New-Item -Path $path -ItemType Directory -Force
@espio999
espio999 / 42sv2017d00e00.sh
Created April 28, 2022 23:30
42 SILICON VALLEY Piscine 2017 Day00 Exercise 00
touch testDay00
chmod u=r,go=rx testDay00
dd if=/dev/zero of=testDay00 bs=1c count=40
@espio999
espio999 / 42sv2017d00e01.sh
Created April 28, 2022 23:43
42 SILICON VALLEY Piscine 2017 Day00 Exercise 01
mkdir test0
dd if=/dev/zero of=test1 bs=1c count=4
chmod u=rwx,g=x,o=r test1
mkdir test2
chmod u=rx,g=,o=r test2
dd if=/dev/zero of=test3 bs=1c count=1
chmod u=r,g=,o=r test3
dd if=/dev/zero of=test4 bs=1c count=2
chmod u=rw,g=r,o=x test4
ln test3 test5
@espio999
espio999 / 42sv2017d00e07.sh
Last active April 29, 2022 00:02
42 SILICON VALLEY Piscine 2017 Day00 Exercise 07
ls -m --time=ctime -F
@espio999
espio999 / 42sv2017d00e08.sh
Created April 29, 2022 00:05
42 SILICON VALLEY Piscine 2017 Day00 Exercise 08
echo 'Z' > z
@espio999
espio999 / 42sv2017d00e09.sh
Created April 29, 2022 00:20
42 SILICON VALLEY Piscine 2017 Day00 Exercise 09
patch b sw.diff
@espio999
espio999 / 42sv2017d00e10.sh
Created April 29, 2022 00:47
42 SILICON VALLEY Piscine 2017 Day00 Exercise 10
find . \(-path "*~" -a -name "#*" -o -name "*#"\) -print -delete
find . \(-name "*~" -o -name "#*" -o -name "*#"\) -print -delete