Skip to content

Instantly share code, notes, and snippets.

View phendork's full-sized avatar
🎯
Focusing

Bahadir Tasdemir phendork

🎯
Focusing
View GitHub Profile
@phendork
phendork / 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
@phendork
phendork / 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;
@phendork
phendork / 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;
@phendork
phendork / 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();
}
@phendork
phendork / 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();
@phendork
phendork / 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
}
@phendork
phendork / 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}
@phendork
phendork / 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'
@phendork
phendork / 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
@phendork
phendork / 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