Skip to content

Instantly share code, notes, and snippets.

View unique1984's full-sized avatar
💭
I may be slow to respond.

Yasin KARABULAK unique1984

💭
I may be slow to respond.
View GitHub Profile
@unique1984
unique1984 / socket_server_tcp.php
Created February 9, 2021 08:25
socket_server_tcp
<?php
$address = "127.0.0.1";
$port = 1984;
# nc -t 127.0.0.1 1984
if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) {
echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
}
@unique1984
unique1984 / socket_client_udp.php
Last active February 9, 2021 08:26
php simple udp socket server/client
<?php
#print_r($argv);
if ($argc == 2) {
$ip = "127.0.0.1";
$port = 1984;
$sending = $argv[1]."\n";
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_connect($sock, "127.0.0.1", 1984);
@unique1984
unique1984 / userdirs.sh
Created April 19, 2020 19:44
Kullanıcı sistem dizinlerini listeleyen komutlar
#!/usr/bin/env bash
echo -e DESKTOP"\t\t" $(xdg-user-dir DESKTOP)
echo -e DOWNLOAD"\t" $(xdg-user-dir DOWNLOAD)
echo -e TEMPLATES"\t" $(xdg-user-dir TEMPLATES)
echo -e PUBLICSHARE"\t" $(xdg-user-dir PUBLICSHARE)
echo -e DOCUMENTS"\t" $(xdg-user-dir DOCUMENTS)
echo -e MUSIC"\t\t" $(xdg-user-dir MUSIC)
echo -e PICTURES"\t" $(xdg-user-dir PICTURES)
echo -e VIDEOS"\t\t" $(xdg-user-dir VIDEOS)
@unique1984
unique1984 / xstat
Created April 18, 2020 09:15 — forked from moiseevigor/xstat
xstat bash function to get file creation time on Linux with EXT4
xstat() {
for target in "${@}"; do
inode=$(ls -di "${target}" | cut -d ' ' -f 1)
fs=$(df "${target}" | tail -1 | awk '{print $1}')
crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null |
grep -oP 'crtime.*--\s*\K.*')
printf "%s\t%s\n" "${crtime}" "${target}"
done
}
@unique1984
unique1984 / psql-with-gzip-cheatsheet.sh
Created February 18, 2020 19:28 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@unique1984
unique1984 / 00_book_links.txt
Last active February 9, 2020 22:49
books.goalkicker.com
@unique1984
unique1984 / 00_book_links.txt
Created February 9, 2020 22:46
books.goalkicker.com
@unique1984
unique1984 / start.sh
Created December 17, 2019 03:55
Marka Bulten CD İçeriği
#!/usr/bin/env bash
cd data
java -cp hsqldb.jar:bulletin.jar com.datasel.tpe.trademark.information.publication.cd.bulletin.appcli.TMBulletinCDApplication
@unique1984
unique1984 / keyCodeEventListener.html
Created November 11, 2019 21:19
Javascript Key Codes
<html lang="tr">
<head>
</head>
<body>
<script type="text/javascript">
document.addEventListener("keypress", function(e){
console.log(e.key + " - " + e.keyCode + " - " + e.code);
});
</script>
@unique1984
unique1984 / docker-help.md
Created October 27, 2019 04:28 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info