Skip to content

Instantly share code, notes, and snippets.

View mkucukdemir's full-sized avatar

Mehmet Küçükdemir mkucukdemir

View GitHub Profile
@mkucukdemir
mkucukdemir / SecurityConfiguration.java
Created December 7, 2021 06:06
To enable POST method for Spring MVC with Security
// Disable CSRF
@Override
protected void configure(HttpSecurity http) throws Exception {
/**
* URL’s ‘/’ & ‘/home’ are not secured, anyone can access them. URL
* ‘/admin/**’ can only be accessed by someone who have ADMIN role. URL
* ‘/db/**’ can only be accessed by someone who have both ADMIN and DBA roles
*/
http.authorizeRequests()
@mkucukdemir
mkucukdemir / postgres_log_in_file.md
Last active November 5, 2021 07:08
Configuring postgresql to log output on a file

In these logs you’ll see the logs from me starting the database, connecting to it from some other terminal, and issuing the obviously erroneous command “select syntax error”. But there are several ways to redirect this elsewhere. The easiest is with pg_ctl’s -l option, which essentially redirects stderr to a file, in which case the startup looks like this:

#os-session> pg_ctl -l logfile -D $PGDATA start

Finally, you can also tell PostgreSQL to redirect its stderr output internally, with the logging_collector option (which older versions of PostgreSQL named “redirect_stderr”). This can be on or off, and when on, collects stderr output into a configured log directory.

So if you end see a log_destination set to “stderr”, a good next step is to check logging_collector:

#postgres-db-session> show logging_collector ;
@mkucukdemir
mkucukdemir / unable_to_reboot_or_shutdown.md
Created February 9, 2021 08:53
If you are unable to shutdown or reboot CentOS 7, these instrcutions may resolve the problem
sudo vim /etc/default/grub

append "nouveau.modeset=0" in GRUB_CMDLINE_LINUX_DEFAULT="...". Then run and

grub2-mkconfig –o /boot/grub2/grub.cfg
grub2-mkconfig -o /etc/grub2.cfg
grub2-mkconfig -o /etc/grub2-efi.cfg
@mkucukdemir
mkucukdemir / boot_win_after_centos_install.md
Last active February 9, 2021 08:02
How to boot Windows 10 partition after installing CentOS 7

The following was tested for Windows7/CentOS7 but most probably will work for UEFI too:

  1. Add the epel repo and install the ntfs-3g package
  2. Mount the windows partitions (most probably /dev/sda1 and sda2) under /mnt/partition_number
  3. Run grub2-mkconfig (depends of UEFI or not) For Non-UEFI:
$ grub2-mkconfig -o /etc/grub2.cfg

For UEFI:

@mkucukdemir
mkucukdemir / git_patch.md
Created March 10, 2020 08:05
How to Create a Patch and How to Apply It on Git

Creating the patch

Create bug_fix_01 branch:

$ git checkout -b bug_fix_01

Do changes ... Commit on branch:

$ git commit -a -m "Message"
@mkucukdemir
mkucukdemir / edison_source.list
Created June 21, 2019 13:14
Ubilinux source update
/et/apt/source.list
deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main
deb http://cdn-fastly.deb.debian.org/debian/ jessie main
deb-src http://cdn-fastly.deb.debian.org/debian/ jessie main
deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
deb http://archive.debian.org/debian jessie-backports main
deb-src http://archive.debian.org/debian jessie-backports main
@mkucukdemir
mkucukdemir / partition_recovery.sh
Created June 21, 2019 08:24
To recover partitions
#add bootable parameter in gpt command
#https://patchwork.ozlabs.org/patch/545499/
gpt write mmc 0 $partitions
part list mmc 0
@mkucukdemir
mkucukdemir / modify_boot_env.sh
Created June 21, 2019 08:22
To modify u-boot env variables
#First
sudo su
mkdir Rootfs
mount ./edison-image-edison.ext4 Rootfs
cp -a Rootfs/* /media/saru/eb361b92-c285-44a6-9f32-da393c879487
sync
# After
setenv mmc-bootargs 'setenv bootargs root=${myrootfs} rootdelay=3 rootfstype=ext4 ${bootargs_console} ${bootargs_debug} systemd.unit=${bootargs_target}.target hardware_id=${hardware_id} g_multi.iSerialNumber=${serial#} g_multi.dev_addr=${usb0addr}'
setenv myrootfs '/dev/mmcblk1p1'
@mkucukdemir
mkucukdemir / resize_virtual_android_machine.md
Created December 5, 2018 07:37
How to resize android virtual machine, step-by-step

Retrieved from https://4sysops.com/archives/change-the-screen-resolution-of-an-android-virtualbox-vm/

  1. Add a custom screen resolution to your VirtualBox VM by opening a command prompt, navigating to your VirtualBox installation folder, and entering the following command:
VBoxManage setextradata "Android 5.1" "CustomVideoMode1" "360x640x16"
  1. Start the VM and, when the GRUB boot menu appears, select the Debug mode.
  2. Wait until the Linux boot process is completed, and then press Enter.
  3. At the Linux prompt, enter the following commands:
mkdir /boot

To install kernel 3.13.0-24

$ sudo apt-get install linux-image-3.13.0-24-generic

To check installed kernel versions

$ dpkg -l | grep linux-image
$ dpkg -l | grep linux-headers

To get current versions