Skip to content

Instantly share code, notes, and snippets.

View koraysaritas's full-sized avatar

Koray Sarıtaş koraysaritas

View GitHub Profile
@koraysaritas
koraysaritas / TheTurkishIProblem.cs
Created July 30, 2015 11:40
This is known as "the Turkish I Problem"
string username = txtUsername.Text.ToUpper().ToUpperInvariant().ToLowerInvariant().ToLower().ToUpperInvariant(); // kerim -> KERIM
@koraysaritas
koraysaritas / BottomRightForm.cs
Created January 11, 2016 10:18
BottomRightForm
Rectangle workingArea = Screen.GetWorkingArea(this);
FrmHede hede = new FrmHede();
hede.StartPosition = FormStartPosition.Manual;
hede.Location = new Point(workingArea.Right - hede.Width, workingArea.Bottom - hede.Height);
// hede.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - hede.Width, Screen.PrimaryScreen.WorkingArea.Height - hede.Height);
@koraysaritas
koraysaritas / rm.txt
Created February 28, 2017 10:52
Remove folders/files matching pattern recursively
# Remove folders matching pattern recursively
FOR /F "tokens=*" %G IN ('DIR /B /AD /S bin') DO RMDIR /S /Q "%G"
FOR /F "tokens=*" %G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%G"
FOR /F "tokens=*" %G IN ('DIR /B /AD /S .vs') DO RMDIR /S /Q "%G"
# Remove files matching pattern recursively
FOR /F "tokens=*" %G IN ('DIR /B /A /S *.log') DO DEL /F /S /Q /A "%G"
@koraysaritas
koraysaritas / add.c
Created April 27, 2017 10:46 — forked from barosl/add.c
Function overloading in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int addi(int a, int b) {
return a + b;
}
char *adds(char *a, char *b) {
char *res = malloc(strlen(a) + strlen(b) + 1);
@koraysaritas
koraysaritas / osquery.txt
Last active May 16, 2017 07:18
Processes which have open network sockets
-- C:\WINDOWS\system32>echo select p.name, p.pid, s.local_address, s.local_port, s.remote_address, s.remote_port from process_open_sockets s join processes p on p.pid = s.pid; | osqueryi
osquery> select p.name, p.pid, s.local_address, s.local_port, s.remote_address, s.remote_port from process_open_sockets s join processes p on p.pid = s.pid;
-- https://osquery.io/docs/tables/#process_open_sockets
-- https://osquery.io/docs/tables/#processes
+------------------------------+-------+---------------------------+------------+---------------------------+-------------+
| name | pid | local_address | local_port | remote_address | remote_port |
+------------------------------+-------+---------------------------+------------+---------------------------+-------------+
0x54CDb5A0303480fb10Fb9163D51785955764e8B8
@koraysaritas
koraysaritas / ht.py
Last active October 22, 2017 16:09
ht
from urllib import parse
from bs4 import BeautifulSoup
elem = '<a title="Sakura Sakura Onsen" href="https://www.google.com/maps?ll=31.8623230000,130.8571860000&amp;spn=0.006130,0.009795&amp;t=k&amp;hl=en">3 BLUE</a>'
# ll
split = parse.urlsplit(elem)
qs = parse.parse_qs(split.query)
ll = qs['ll'][0].split(',')
#!/usr/local/bin/python3
from itertools import count
def stop():
raise StopIteration
every15 = set()
list(stop() if (n % 1000) in every15 else every15.add(n % 1000) for n in count(1, step=15))
print(1000 - len(every15))
@koraysaritas
koraysaritas / mac-clear-icon-cache.sh
Created July 12, 2019 19:59 — forked from ismyrnow/mac-clear-icon-cache.sh
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder
@koraysaritas
koraysaritas / eventListener.js
Created July 24, 2019 14:11 — forked from shayanb/eventListener.js
simple NodeJS app to display triggered events on a smart contract
// This is a simple NodeJS app to display triggered events on a smart contract
// you need your contract ABI and deployed address and also a synced geth running
// github.com/shayanb
var optionsABI = [YOUR_CONTRACT_ABI]
var contractAddress = "0xYOUR_CONTRACT_ADDRESS"
var Web3 = require('web3');