Skip to content

Instantly share code, notes, and snippets.

View safaorhan's full-sized avatar
👋
Hey.

Safa Orhan safaorhan

👋
Hey.
View GitHub Profile
@safaorhan
safaorhan / FrequentLetterGenerator.java
Created June 10, 2018 03:12
Random english letter generator according to their frequencies in English.
package com.safaorhan.example;
public class FrequentLetterGenerator {
private static char[] letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
private static float[] weights = new float[]{
8.167f,
1.492f,
2.782f,
4.253f,
12.702f,
@safaorhan
safaorhan / test.js
Created March 22, 2018 13:05
GET /customer
//status code is 200
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
//reponse body is json()
pm.test("Response body should be json",function(){
pm.response.to.have.jsonBody();
})
@safaorhan
safaorhan / pre-request.js
Last active March 22, 2018 13:02
POST /customers
var firstName = getRandomFirstName();
var lastName = getRandomLastName();
var uniqueEmail = getUniqueEmail();
/*
* Generate random names and email address
* and save them into the environment variables.
* So that we can use the values in the request body.
*/
@safaorhan
safaorhan / .bash_profile
Last active December 22, 2017 15:09
Connects to first available android device. Useful if you make an alias.
alias adbc="source ~/.bash_profile && adb -s $(adb devices | grep -E -e '^(.+)\s+device$' -o | grep -E -o -e '(.*)\s') shell"
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="weight_light">300</integer>
<integer name="weight_regular">400</integer>
<integer name="weight_semi_bold">600</integer>
<integer name="weight_bold">700</integer>
<integer name="weight_extra_bold">800</integer>
</resources>
@safaorhan
safaorhan / multiple-deploy-keys-multiple-private-repos-github-ssh-config.md How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

Let's say alice is a github.com user, with 2 or more private repositories repoN. For this example we'll work with just two repositories named repo1 and repo2

https://github.com/alice/repo1

https://github.com/alice/repo2

You need to be to pull from these repositories without entering a passwords probably on a server, or on multiple servers. You want to perform git pull origin master for example, and you want this to happen without asking for a password.

@safaorhan
safaorhan / Utils.java
Last active October 3, 2022 13:36
Java / Android TC Kimlik No Doğrulama
// Yalnızca UI onayı için kullanılmalıdır
// İş önemi olan durumlarda bu api'yi kullanmalısınız:
// https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?op=TCKimlikNoDogrula
private boolean isTCKNCorrect(String id) {
if (id == null) return false;
if (id.length() != 11) return false;
char[] chars = id.toCharArray();
@safaorhan
safaorhan / default
Created March 29, 2017 21:41
Deployd API & Vue Admin Panel | Nginx Config
server {
listen 80;
server_name api.my.domain.com;
location / {
proxy_pass http://localhost:3000;
}
}
//Below the class
private int currentIndex = 0;
//On button Click
currentIndex++;
EventItem currentItem = EventAdapter.getItem(currentIndex);
drawItem(currentItem);
// production.js
var deployd = require('deployd');
var server = deployd({
port: process.env.PORT || 5000,
env: 'development',
db: {
host: 'localhost', // Our mongo instance runs in our server itself. Remember? (127.0.0.1)
port: 27017, // Update this line,
name: 'deployd', // this line,