Skip to content

Instantly share code, notes, and snippets.

View 0o001's full-sized avatar
🌽

Mustafa Ateş UZUN 0o001

🌽
View GitHub Profile
@0o001
0o001 / CustomRandom.js
Last active September 15, 2022 20:05
Custom random class in javascript
class CustomRandom {
constructor() {
this.seed = this.#getMillisecondsArray();
}
#getMillisecondsArray() {
return [...(new Date).getMilliseconds().toString()].map(Number);
}
random() {
@0o001
0o001 / max.js
Created September 15, 2022 11:18
finding max or min value in array with reduce function
let max = array.reduce((p, n)=> p > n ? p : n );
@0o001
0o001 / MessageBoxManager.cs
Created November 15, 2019 14:12
component: MessageBoxManager.cs
/*Kullanımı:
MessageBoxManager.OK = "&Siteye Git...";
MessageBoxManager.Cancel = "&Tamam";
MessageBoxManager.Register();
DialogResult git = MessageBox.Show("Bu program null tarafından yapılmıştır.\nDestek almak ya da görüşlerinizi bildirmek için www.nullovy.com sitesine gidebilirsiniz.", "Hakkında", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
MessageBoxManager.Unregister();
if (git == System.Windows.Forms.DialogResult.OK)
{
System.Diagnostics.Process.Start("http://www.nullovy.com");
}*/
@0o001
0o001 / ColorTabControl.cs
Created November 15, 2019 14:11
component: ColorTabControl.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
@0o001
0o001 / admin.cs
Last active November 15, 2019 14:25
how to check IsAdministrator
//Kullanıcının yönetici olup olmadığını öğrenme
public static bool IsAdministrator()
{
return (new WindowsPrincipal(WindowsIdentity.GetCurrent()))
.IsInRole(WindowsBuiltInRole.Administrator);
}
@0o001
0o001 / restartservice.cs
Last active November 15, 2019 14:25
how to Start/Stop Windows Service
//Bilgisayar servislerine erişme
public static void RestartService(string serviceName)
{
ServiceController service = new ServiceController(serviceName);
try
{
//Durdur
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped);
@0o001
0o001 / setwallpaper.cs
Last active November 15, 2019 14:25
how to Set Wallpaper
//Arka plan değiştirme
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SystemParametersInfo(UInt32 action, UInt32 uParam, String vParam, UInt32 winIni);
public void SetWallpaper(String path) //Arka planı ayarlamak için
{
SystemParametersInfo(0x14, 0, path, 0x01 | 0x02);
}
SetWallpaper("yol/arkaplan");
@0o001
0o001 / blur.cs
Last active November 15, 2019 14:25
how to Image Blur
//Resmi blur yapma
private Bitmap Blur(Image img)
{
Bitmap pic = new Bitmap(img);
for (int w = 0; w < pic.Width; w++)
{
for (int h = 0; h < pic.Height; h++)
{
Color c = pic.GetPixel(w, h);
Color newC = Color.FromArgb(80, c);
@0o001
0o001 / clipboard.cs
Last active November 15, 2019 14:25
how to Copy Clipboard
//Kopyalama bilgileri
Clipboard.ContainsText(); //Panoda kopya var mı
Clipboard.GetText(); //Panodaki texti ver
Clipboard.ContainsImage(); //Panoda resim var mı
Clipboard.GetImage(); //Panodaki resimi ver
Clipboard.ContainsFileDropList(); //Panoda dosya var mı
Clipboard.GetFileDropList(); //Panodaki dosya listesini ver
Clipboard.SetText("metin"); //Panodaki kopyayı değiştir
@0o001
0o001 / draggable.cs
Last active November 15, 2019 14:24
how to Not Draggable Form
protected override void WndProc(ref Message m) //Form sürüklemesini kapat
{
const int WM_SYSCOMMAND = 0x0112;
const int SC_MOVE = 0xF010;
switch (m.Msg)
{
case WM_SYSCOMMAND:
int command = m.WParam.ToInt32() & 0xfff0;
if (command == SC_MOVE)