Skip to content

Instantly share code, notes, and snippets.

View tasdemirbahadir's full-sized avatar
🎯
Focusing

Bahadir Tasdemir tasdemirbahadir

🎯
Focusing
View GitHub Profile
@tasdemirbahadir
tasdemirbahadir / instrument_remover.py
Last active February 14, 2026 09:11
song instrument removed
#!/usr/bin/env python3
"""
Parametric Drum or Guitar Removal Tool using Demucs
Removes either drums or guitar from WAV files based on user input.
"""
import os
import argparse
import subprocess
import sys
@tasdemirbahadir
tasdemirbahadir / Substract1FromBinary.java
Created June 6, 2020 07:57
Substract 1 from binary data. For example "00000011" - 1 -> "00000010"
private static String substract1(String binVal) {
StringBuilder sb = new StringBuilder();
int remainder = 0;
for (int i = binVal.length() - 1; i >= 0; i--) {
if (binVal.charAt(i) == '0') {
sb.insert(0, '1');
remainder = 1;
} else if (i > 0) {
sb.insert(0, '0');
remainder = 0;
@tasdemirbahadir
tasdemirbahadir / Add1ToBinary.java
Created June 6, 2020 07:54
Add 1 to binary data. Fro example "00000010" + 1 -> "00000011"
private static String add1(String binVal) {
StringBuilder sb = new StringBuilder();
int remainder = 0;
for (int i = binVal.length() - 1; i >= 0; i--) {
if (binVal.charAt(i) == '1') {
sb.insert(0, '0');
remainder = 1;
} else {
sb.insert(0, '1');
remainder = 0;
@tasdemirbahadir
tasdemirbahadir / StringToBinary.java
Created June 6, 2020 07:52
Convert a string representation of a number to binary format. For example "2" -> "00000010"
private static String numToBin(String num) {
BigInteger bi = new BigInteger(num);
byte[] val = bi.toByteArray();
StringBuilder sb = new StringBuilder();
for (byte b: val) {
sb.append(String.format("%8s", Integer.toBinaryString(b & 0xFF)).replace(' ', '0'));
}
sb.toString();
}
@tasdemirbahadir
tasdemirbahadir / conditional-on-property-to-load-beans-sample.java
Last active April 23, 2020 08:07
Conditional On Property To Load Beans Sample
@Configuration
public class FeatureTogglingBeans {
@Bean
@ConditionalOnProperty(
name = "feature.version",
havingValue = "v1",
matchIfMissing = true)
public SampleService sampleService() {
return new DefaultSampleService();
@tasdemirbahadir
tasdemirbahadir / configuration-properties-sample.java
Created April 21, 2020 15:12
Spring Boot Configuration Properties Sample
@ConfigurationProperties(prefix = "feature")
public class ConfigProperties {
private String firstFeatureVersion;
private String secondFeatureVersion;
// getters and setters
}
@tasdemirbahadir
tasdemirbahadir / app-project-deployment-sample.yml
Created April 21, 2020 14:15
App project deployment yml file sample
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${CI_PROJECT_NAME}-deployment
namespace: ${NAMESPACE}
spec:
replicas: ${REPLICA}
selector:
matchLabels:
app: ${CI_PROJECT_NAME}
@tasdemirbahadir
tasdemirbahadir / sample-configs.yml
Last active April 21, 2020 14:12
Demonstrates a sample for configs.yml
apiVersion: v1
kind: ConfigMap
metadata:
name: ${CI_PROJECT_NAME}-config
namespace: namespace
data:
FEATURE_TOGGLE_NOTIFICATION: 'false'
VERSION_DOCUMENT_UPLOAD: 'v2'
@tasdemirbahadir
tasdemirbahadir / config-sample-gitlab-ci.yml
Last active April 22, 2020 06:38
Demonstration of config application to K8s.
variables:
VERSION: $CI_COMMIT_SHORT_SHA
image: kubectl-image
stages:
- Apply QA
- Redeploy QA
- Apply Stage
- Redeploy Stage
@tasdemirbahadir
tasdemirbahadir / quality-measurement-controller-test.java
Last active April 7, 2020 17:53
Sample JUnit 5 test for quality measurement project
@ExtendWith(SpringExtension.class)
@WebMvcTest(TestController.class)
class TestControllerTest {
@Autowired
private MockMvc mockMvc;
@Test
void it_should_get_test_message() throws Exception {
//Given